State Farm Distracted Drivers

Prev Exercises: Udacity:DeepLearning:TensorFlow:notMNIST

Fit Multi Layer Perceptron (MLP) with Rectified Linear Units (RELUs) SGD with random image rotation (TensorFlow)

In [1]:
import sys
print sys.version

from joblib import Parallel, delayed  
import multiprocessing
nCores = multiprocessing.cpu_count() - 2 # Allow other apps to run
print 'nCores: %d' % (nCores)

from datetime import datetime, time
print 'now: %s' % str(datetime.now())
2.7.11 (default, Jan 28 2016, 14:07:46) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
nCores: 14
now: 2016-05-24 05:53:27.793843
In [2]:
import matplotlib.pyplot as plt
%matplotlib inline
from IPython.display import display, Image
import rpy2.robjects as robjects
from rpy2.robjects.packages import importr
from rpy2.robjects.lib import grid
from rpy2.robjects.lib import ggplot2
import rpy2.robjects.pandas2ri

import numpy as np
np.set_printoptions(precision=4, suppress=True)
import os
import pandas as pd
from scipy import ndimage
from six.moves.urllib.request import urlretrieve
from six.moves import cPickle as pickle

import tensorflow as tf
print 'tf.__version__:%s' % str(tf.__version__)

%run img_utils.py
tf.__version__:0.8.0
/usr/local/lib/python2.7/site-packages/rpy2/robjects/lib/ggplot2.py:59: UserWarning: This was designed againt ggplot2 version 2.0.0 but you have 2.1.0
  warnings.warn('This was designed againt ggplot2 version %s but you have %s' % (TARGET_VERSION, ggplot2.__version__))

Analytics Specs

This Project

In [3]:
%run img_glbSpec_SFDD_ImgSz_64.py
imported img_glbSpec_SFDD_Img_Sz_64.py
In [4]:
# print '\nglbDataFile: %s' % (glbDataFile)

print '\nglbRspClass: %s' % (glbRspClass)
print 'glbRspClassN: %d' % (glbRspClassN)
print 'glbRspClassDesc: '; print(glbRspClassDesc)

print '\nglbImg:'; print(glbImg)

print '\nglbTfwVarSeed: %d' % (glbTfwVarSeed)

print '\nglbPickleFile: %s' % (glbPickleFile)
glbRspClass: ['c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9']
glbRspClassN: 10
glbRspClassDesc: 
{'c9': 'talking to passenger', 'c8': 'hair and makeup', 'c3': 'texting - left', 'c2': 'talking on the phone - right', 'c1': 'texting - right', 'c0': 'normal driving', 'c7': 'reaching behind', 'c6': 'drinking', 'c5': 'operating the radio', 'c4': 'talking on the phone - left'}

glbImg:
{'color': False, 'crop': {'x': (80, 560)}, 'shape': (480, 640, 3), 'pxlDepth': 255.0, 'center_scale': True, 'size': 64}

glbTfwVarSeed: 131

glbPickleFile: {'models': 'data/img_M_SFDD_ImgSz_64.pickle', 'data': 'data/img_D_SFDD_ImgSz_64.pickle'}

Import Data

This Project

In [5]:
%run img_utils.py
glbObsFitIdn, glbObsFitFtr, glbObsFitRsp, \
glbObsVldIdn, glbObsVldFtr, glbObsVldRsp, \
glbObsNewIdn, glbObsNewFtr, glbObsNewRsp, \
sbtNewCorDf, \
_ = myimportDbs(glbPickleFile['data'])

glbObsTrnIdn = glbObsFitIdn + glbObsVldIdn
glbObsTrnFtr = np.vstack((glbObsFitFtr, glbObsVldFtr))
glbObsTrnRsp = np.concatenate((glbObsFitRsp, glbObsVldRsp))

print('Fit pickled set:', 
      len(glbObsFitIdn), glbObsFitFtr.shape, glbObsFitRsp.shape)
print('Vld pickled set:', 
      len(glbObsVldIdn), glbObsVldFtr.shape, glbObsVldRsp.shape)
print('Trn pickled set:', 
      len(glbObsTrnIdn), glbObsTrnFtr.shape, glbObsTrnRsp.shape)    
print('New pickled set:', 
      len(glbObsNewIdn), glbObsNewFtr.shape, glbObsNewRsp.shape)
Importing database from data/img_D_SFDD_ImgSz_64.pickle...
('Fit pickled set:', 18077, (18077, 64, 64), (18077,))
('Vld pickled set:', 4347, (4347, 64, 64), (4347,))
('Trn pickled set:', 22424, (22424, 64, 64), (22424,))
('New pickled set:', 79726, (79726, 64, 64), (79726,))

First reload the data we generated in 1_notmist.ipynb.

In [7]:
# pickle_file = 'data/notMNIST.pickle'

# with open(pickle_file, 'rb') as f:
#   save = pickle.load(f)
#   glbXFit = save['glbXFit']
#   glbYFit = save['glbYFit']
#   glbXVld = save['glbXVld']
#   glbYVld = save['glbYVld']
#   glbXNew = save['glbXNew']
#   glbYNew = save['glbYNew']
#   del save  # hint to help gc free up memory
#   print('Training set', glbXFit.shape, glbYFit.shape)
#   print('Validation set', glbXVld.shape, glbYVld.shape)
#   print('Test set', glbXNew.shape, glbYNew.shape)

Reformat into a shape that's more adapted to the models we're going to train:

  • data as a flat matrix,
  • labels as float 1-hot encodings.
In [6]:
def lclreformatData(I, X, Y):  
  X = X.reshape((-1, glbImg['size'] * glbImg['size'])).astype(np.float32)
  # Map 0 to [1.0, 0.0, 0.0 ...], 1 to [0.0, 1.0, 0.0 ...]
  Y = (np.arange(glbRspClassN) == Y[:,None]).astype(np.float32)
  return I, X, Y

glbITrn, glbXTrn, glbYTrn = lclreformatData(
    glbObsTrnIdn, glbObsTrnFtr, glbObsTrnRsp)
glbIFit, glbXFit, glbYFit = lclreformatData(
    glbObsFitIdn, glbObsFitFtr, glbObsFitRsp)
glbIVld, glbXVld, glbYVld = lclreformatData(
    glbObsVldIdn, glbObsVldFtr, glbObsVldRsp)
glbINew, glbXNew, glbYNew = lclreformatData(
    glbObsNewIdn, glbObsNewFtr, glbObsNewRsp)

print('Trn reshaped set:', len(glbITrn), glbXTrn.shape, glbYTrn.shape)
print('Fit reshaped set:', len(glbIFit), glbXFit.shape, glbYFit.shape)
print('Vld reshaped set:', len(glbIVld), glbXVld.shape, glbYVld.shape)
print('New reshaped set:', len(glbINew), glbXNew.shape, glbYNew.shape)
('Trn reshaped set:', 22424, (22424, 4096), (22424, 10))
('Fit reshaped set:', 18077, (18077, 4096), (18077, 10))
('Vld reshaped set:', 4347, (4347, 4096), (4347, 10))
('New reshaped set:', 79726, (79726, 4096), (79726, 10))
In [7]:
# Check how much incremental memory is used for Fit obs
# del glbObsFitIdn, glbObsFitFtr, glbObsFitRsp
# del glbIFit, glbXFit, glbYFit

# Check how much incremental memory is used for Trn obs
del glbObsTrnIdn, glbObsTrnFtr, glbObsTrnRsp
del glbITrn, glbXTrn, glbYTrn
In [8]:
# print glbObsFitFtr.shape
print glbObsTrnFtr.shape
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-8-f345b4057731> in <module>()
      1 # print glbObsFitFtr.shape
----> 2 print glbObsTrnFtr.shape

NameError: name 'glbObsTrnFtr' is not defined

Fit MLP with RELUs (TensorFlow)

Turn the logistic regression example with SGD into a 1-hidden layer neural network with rectified linear units (nn.relu()) and nRELUs hidden nodes. This model should improve your validation / test accuracy_score.

In [9]:
%run img_glbSpec_SFDD_ImgSz_64.py
%run img_utils.py

# Add parameter for lrnRateTfw = 0.5 for GradientDescentOptimizer

def fitMdlMLPRELUSGDTfw(lclXFit, lclYFit, 
            nObsFit = 100, nObsBtc = 16, 
            rotatePby = 0.1, rotateMaxAgl = 5,
            nRELUs = 128,            
            nStepsTfw = 10, lrnRateTfw = 0.1,
                    visualize = False, newObs = False, verbose = False):
    
    from scipy.ndimage import rotate    
    from sklearn import metrics as skl_metrics
    
    prtStr = '\nLogistic Regression (TensorFlow): ' + \
          "nObsFit:%5d; nObsBtc:%5d; " + \
          "rotatePby: %.4f; rotateMaxAgl: %3d; " + \
          "nRELUs: %5d; " + \
          "nStepsTfw:%5d; lrnRateTfw:%.4f "
    print(prtStr % ( \
            nObsFit, nObsBtc, \
            rotatePby, rotateMaxAgl, \
            nRELUs, \
            nStepsTfw, lrnRateTfw))
    print("  visualize: %s; newObs: %s; verbose: %s" % ( \
            visualize, newObs, verbose))
    
    # Ensure each Fit obs used at least once during training
    if (nStepsTfw * nObsBtc < nObsFit):
        print "  nStepsTfw * nObsBtc < nObsFit: %5d < %5d" % (\
                    nStepsTfw * nObsBtc, nObsFit)
        nStepsTfw = int(nObsFit / nObsBtc + 1) 
        print "  overriding nStepsTfw: %5d" % (nStepsTfw)
    
    startTm = datetime.now()

    mdlDf = pd.DataFrame({'id': 'MLP.SGD.tfw',
                             'nObsFit': [nObsFit],
                             'nObsBtc': [nObsBtc],
                           'rotatePby': [rotatePby],
                        'rotateMaxAgl': [rotateMaxAgl],
                              'nRELUs': [nRELUs],                          
                           'nStepsTfw': [nStepsTfw],
                          'lrnRateTfw': [lrnRateTfw]
                         })
    
    graph = tf.Graph()
    with graph.as_default():

      # Input data.
      # The training data, we use a placeholder that will be fed
      #   at run time with a training minibatch.
      # The validation data into constants that 
      #  are attached to the graph.
      # The tests data is loaded by batch thru a placeholder
#       tfwXFit = tf.constant(lclXFit[:nObsFit, :])
#       tfwYFit = tf.constant(lclYFit[:nObsFit])
      tfwXFit = tf.placeholder(tf.float32,
                    shape = (nObsBtc, lclXFit.shape[1]))
      tfwYFit = tf.placeholder(tf.float32, 
                    shape = (nObsBtc, lclYFit.shape[1]))
      tfwXVld = tf.constant(glbXVld)
      tfwYVld = tf.constant(glbYVld)   
      tfwXNew = tf.placeholder(tf.float32, 
                    shape = (glbImg['size'], lclXFit.shape[1]))
      tfwYNew = tf.placeholder(tf.float32, 
                    shape = (glbImg['size'], lclYFit.shape[1]))

      # Variables.
      tf.set_random_seed(glbTfwVarSeed)
    
      # These are the parameters that we are going to be training. 
      # The weight matrix will be initialized using random valued 
      # following a (truncated) normal distribution. 
      # The bias vector get initialized to zero.
      tfwW1 = tf.Variable(
        tf.truncated_normal([glbImg['size'] * glbImg['size'], 
                             nRELUs]), 
        name = 'tfwW1')
      tfwB1 = tf.Variable(tf.zeros([nRELUs]), name = 'tfwB1')
      tfwW3 = tf.Variable(
        tf.truncated_normal([nRELUs, 
                             glbRspClassN]), 
        name = 'tfwW3')
      tfwB3 = tf.Variable(tf.zeros([glbRspClassN]), name = 'tfwB3')
      if (verbose):  
          print('  tfwW1:', tfwW1.initialized_value())
          print('  tfwB1:', tfwB1.initialized_value())
          print('  tfwW3:', tfwW3.initialized_value())
          print('  tfwB3:', tfwB3.initialized_value())
#         print 'lblIx:%2d:%s'% \
#     (np.vectorize("%.4e".__mod__)(tfwW.value()[:5, lblIx]))

      def model(X):
          lyr1 = tf.matmul(X, tfwW1) + tfwB1
          lyr2 = tf.nn.relu(lyr1)
          YLgt = tf.matmul(lyr2, tfwW3) + tfwB3
          return(YLgt)

      # Training computation.
      # We multiply the inputs with the weight matrix, and add bias. 
      # We compute the softmax and cross-entropy (it's one operation in
      # TensorFlow, because it's very common, and it can be optimized). 
      # We take the average of this cross-entropy across all training 
      # examples: that's our loss.
      logits = model(tfwXFit)
      loss = tf.reduce_mean(
        tf.nn.softmax_cross_entropy_with_logits(logits, tfwYFit))

      # Optimizer.
      # We are going to find the minimum of this loss using 
      #  gradient descent.
      optimizer = (tf.train
                   .GradientDescentOptimizer(tf.to_float(lrnRateTfw))
                   .minimize(loss))

      # Predictions for the training, validation, and test data.
      # These are not part of training, but merely here so that we can
      # report accuracy_score figures as we train.
      tfwYFitPby = tf.nn.softmax(logits)
      tfwYVldPby = tf.nn.softmax(model(tfwXVld))
      tfwYNewPby = tf.nn.softmax(model(tfwXNew))
    
    def accuracy_score(predictions, labels):
      return (1.0 * np.sum(np.argmax(predictions, 1) == 
                           np.argmax(labels, 1))
              / predictions.shape[0])

    tf.set_random_seed(glbTfwVarSeed)
    # For image rotation in feed_dict. Separate seed to ensure 
    #   deterministic performance by tf session irrespective of 
    #   rotation randomization
    np.random.seed(glbNPySeed) 
    with tf.Session(graph=graph) as session:
      # This is a one-time operation which ensures the parameters get
      # initialized as we described in the graph: 
      # random tfwW for the matrix, zeros for the tfwB. 
      tf.initialize_all_variables().run()
      if verbose:
          print('  Initialized')
        
      # Create a dummy feed for test data & occlusion visualization
#       btcNewDct = {tfwXNew: glbXNew[:glbImg['size'], :]}
      for step in range(int(nStepsTfw)):
        
        # Pick an offset within the training data, which has been 
        #   randomized.
        # Note: we could use better randomization across epochs.
        offset = (step * nObsBtc) % (nObsFit - nObsBtc)
        # Generate a minibatch (w/ or w/o rotation)
        if (np.random.rand() > rotatePby):
            btcXFit = lclXFit[offset:(offset + nObsBtc), :]
        else:
            rawXFit = np.reshape(lclXFit[offset:(offset + nObsBtc), :],
                            (nObsBtc, glbImg['size'], glbImg['size']))
            rttXFit = np.zeros_like(rawXFit)
            angle = (np.random.rand() - 0.5) * 2 * rotateMaxAgl
            if (verbose): 
                prtStr = '  step %5d(%5d secs): Minibatch rotation:' + \
                         "angle: %.4f"
                print(prtStr % \
                    (step, thsDrn, \
                     angle))            
#             print '  rawXFit.shape: %s' % (str(rawXFit.shape))
            for ix in xrange(rawXFit.shape[0]):                
#                 if (ix % 10 == 0): 
#                     print '    rawXFit[ix, :, :].shape: %s' % \
#                         (str(rawXFit[ix, :, :].shape))                
                rttXFit[ix, :, :] = rotate(rawXFit[ix, :, :], angle, 
                                        mode = 'nearest', reshape = False)
            btcXFit = np.reshape(rttXFit, 
                        (nObsBtc, glbImg['size'] * glbImg['size']))
            
        btcYFit = lclYFit[offset:(offset + nObsBtc), :]
        
        # Prepare a dictionary telling the session where to feed the 
        #   minibatch. The key of the dictionary is the placeholder node
        #   of the graph to be fed, and the value is the numpy array to 
        #   feed to it.
        feed_dict = {tfwXFit: btcXFit, tfwYFit: btcYFit,
                     tfwXNew: glbXNew[:glbImg['size'], :]}        
        
        # Run the computations. 
        # We tell .run() that we want to run the optimizer,
        # and get the loss value and the training predictions returned
        # as numpy arrays.
        _, l, predictions = \
            session.run([optimizer, loss, tfwYFitPby], 
                        feed_dict = feed_dict)
            
        if mydspVerboseTrigger(step):
          thsDrn = (datetime.now() - startTm).seconds  
          if (thsDrn > 100):
              prtStr = '  step %5d(%5d secs): Minibatch ' + \
                        "accuracy: %.4f; logloss: %.4f"  
              print(prtStr % \
                    (step, thsDrn, 
                     accuracy_score(predictions, btcYFit), l))
        
      # Calling .eval() on tfwObsVldPred is basically like calling run(), 
      # but just to get that one numpy array. 
      # Note that it recomputes all its graph dependencies.
    
      lclYVldPby = tfwYVldPby.eval()
      lclYVldPdn = np.argmax(lclYVldPby, 1)
      mdlDf['accVld'] = accVld = accuracy_score(lclYVldPby, glbYVld)
      cnfYVld = skl_metrics.confusion_matrix(glbObsVldRsp, lclYVldPdn)
      accYVldCls = cnfYVld.diagonal() * 1.0 / cnfYVld.sum(axis = 1)
      mdlDf['accVldCls'] = None
      mdlDf.set_value(0, 'accVldCls', {'accCls' : accYVldCls})
    
      mdlDf['logLossVld'] = logLossVld = skl_metrics.log_loss(
                                                glbYVld, lclYVldPby)
      logLossVldCls = mygetMetricLogLoss(glbYVld, lclYVldPby, 
                                         returnTyp = 'class')
      mdlDf['logLossVldCls'] = None
      mdlDf.set_value(0, 'logLossVldCls', 
                      {'logLossCls' : logLossVldCls})

      if verbose:
        print '\n  Vld accuracy:%0.4f' % (accVld)
        print accYVldCls
        print cnfYVld
        yLbl = [glbRspClassDesc[glbRspClass[ix]] + ':' + \
                  glbRspClass[ix] + ':actl' \
                for ix in xrange(glbRspClassN)]
        xLbl = ['pred:' + glbRspClass[ix] + ':' + \
                glbRspClassDesc[glbRspClass[ix]] \
                   for ix in xrange(glbRspClassN)]
        # print labels
        plt.matshow(cnfYVld, cmap='Reds', interpolation='none')
        plt.yticks(np.arange(10), yLbl)
        plt.xticks(np.arange(10), xLbl, rotation=90);
        plt.show()

        print '\n  Vld  logLoss:%0.4f' % (logLossVld)
        print logLossVldCls

      if visualize:
        mydisplayImagePredictions(session, tfwW1.eval(),
                glbIVld, glbObsVldFtr, glbObsVldRsp, lclYVldPby, 
                glbRspClass, glbRspClassDesc, imgVisualFn = plot_occlusion, 
                            tfwXOcc = tfwXNew, tfwYOccPby = tfwYNewPby)    
            
      if newObs:
          print "  predicting %5d new obs..." % (glbYNew.shape[0])  
          lclYNewPby = np.zeros((glbYNew.shape[0], 
                                 tfwYFitPby.get_shape().as_list()[1]))
          lclYNewPby[:, :] = -1.0
          btcSz = tfwXNew.get_shape().as_list()[0]  
          for obsIx in xrange(0, glbYNew.shape[0], btcSz):
            if mydspVerboseTrigger(obsIx) and \
              (datetime.now() - startTm).seconds > 60:
                print "    @%5d secs: obsIx: %5d" % \
                    ((datetime.now() - startTm).seconds, obsIx)    
            obsEnd = obsIx + btcSz
            if obsEnd > lclYNewPby.shape[0]: 
                obsEnd = lclYNewPby.shape[0]                
            btcYNewPby = session.run(tfwYNewPby, 
                feed_dict = {tfwXNew: glbXNew[obsIx:obsEnd, :] \
                    if obsEnd != lclYNewPby.shape[0] \
                    else np.vstack((glbXNew[obsIx:obsEnd, :], 
                            glbXNew[0:((obsIx + btcSz) % obsEnd), :]))
                                })
            lclYNewPby[obsIx:obsEnd, :] = btcYNewPby[:, :] \
                                if obsEnd != lclYNewPby.shape[0] \
                                else btcYNewPby[:(obsEnd - obsIx), :]    
          
          assert (lclYNewPby[:, :] != -1.0).all(), \
            'some cells in lclYNewPby == -1.0'
#           lclYNewPdn      = tfwYNew.eval()            
#           lclYNewPby = tfwYNewPby.eval()
          lclYNewPdn = np.argmax(lclYNewPby, 1) 
          #if (tfwYNew.eval() > -1).any():
          if (len(np.unique(glbYNew, return_counts = True)[0]) > 1):        
              mdlDf['accNew'] = accNew = accuracy_score(lclYNewPby, 
                                                        glbYNew)
              mdlDf['logLossNew'] = logLossNew = skl_metrics.log_loss(
                                                glbYNew, lclYNewPby)    
              if verbose:      
                print '\n  New accuracy:%0.4f' % (accNew)
                print   '  New  logLoss:%0.4f' % (logLossNew)        
                print skl_metrics.confusion_matrix(glbObsNewRsp, 
                                                   lclYNewPdn)
                yLbl = [glbRspClassDesc[glbRspClass[ix]] + ':' + 
                          glbRspClass[ix] + ':actl' \
                        for ix in xrange(glbRspClassN)]
                xLbl = ['pred:' + glbRspClass[ix] + ':' + \
                        glbRspClassDesc[glbRspClass[ix]] \
                           for ix in xrange(glbRspClassN)]
                # print labels
                plt.matshow(skl_metrics.confusion_matrix(glbObsNewRsp, 
                                                         lclYNewPdn), 
                            cmap='Reds', interpolation='none')
                plt.yticks(np.arange(10), yLbl)
                plt.xticks(np.arange(10), xLbl, rotation=90);
                plt.show()
                
          if visualize:      
              mydisplayImagePredictions(session, tfwW1.eval(),
                glbINew, glbObsNewFtr, glbObsNewRsp, lclYNewPby, 
                glbRspClass, glbRspClassDesc, imgVisualFn = plot_occlusion, 
                        tfwXOcc = tfwXNew, tfwYOccPby = tfwYNewPby)    

          mdlDf['predNew'] = None
          mdlDf.set_value(0, 'predNew', {'kntCls' : np.unique(lclYNewPdn, 
                                            return_counts = True)})
          if verbose:
            print '\n  New prediction knts:'
            print mdlDf['predNew'][0]
            
      # indentation (6 spaces) determines scope of this
      #   before session.__exit__ & graph.__exit__        
      mdlDf['model'] = session 
    
    mdlDf['duration'] = (datetime.now() - startTm).seconds  
    print('  duration: %.2d seconds' % (mdlDf['duration'][0]))  
    
    if not newObs: lclYNewPby = None
    return(mdlDf, lclYVldPby, lclYNewPby)

tmpMdlDf = pd.DataFrame()

# thsMdlDf, thsYVldPby, thsYNewPby = fitMdlMLPRELUSGDTfw(
#     glbXFit, glbYFit, 
#     nObsFit = 100, nObsBtc = 16, 
#     rotatePby = 0.2, rotateMaxAgl = 10,
#     nRELUs = 128,    
#     nStepsTfw = 10, lrnRateTfw = 0.5,
#     visualize = True, newObs = True, verbose = True)
# tmpMdlDf = tmpMdlDf.append(thsMdlDf)

# To check if model results are deterministic & 
# all run options work separately
thsMdlDf, thsYVldPby, thsYNewPby = fitMdlMLPRELUSGDTfw(
    glbXFit, glbYFit, 
    nObsFit = 100, nObsBtc = 16, 
    rotatePby = 0.2, rotateMaxAgl = 10, 
    nRELUs = 128,
    nStepsTfw = 10, lrnRateTfw = 0.5, 
    visualize = True, newObs = False, verbose = False)
tmpMdlDf = tmpMdlDf.append(thsMdlDf)

thsMdlDf, thsYVldPby, thsYNewPby = fitMdlMLPRELUSGDTfw(
    glbXFit, glbYFit, 
    nObsFit = 100, nObsBtc = 16, 
    rotatePby = 0.2, rotateMaxAgl = 10,    
    nRELUs = 128,    
    nStepsTfw = 10, lrnRateTfw = 0.5, 
    visualize = False, newObs = True, verbose = False)
tmpMdlDf = tmpMdlDf.append(thsMdlDf)

thsMdlDf, thsYVldPby, thsYNewPby = fitMdlMLPRELUSGDTfw(
    glbXFit, glbYFit, 
    nObsFit = 100, nObsBtc = 16, 
    rotatePby = 0.2, rotateMaxAgl = 10,    
    nRELUs = 128,    
    nStepsTfw = 10, lrnRateTfw = 0.5, 
    visualize = False, newObs = False, verbose = True)
tmpMdlDf = tmpMdlDf.append(thsMdlDf)

thsMdlDf, thsYVldPby, thsYNewPby = fitMdlMLPRELUSGDTfw(
    glbXFit, glbYFit, 
    nObsFit = 100, nObsBtc = 16, 
    rotatePby = 0.2, rotateMaxAgl = 10,
    nRELUs = 128,    
    nStepsTfw = 10, lrnRateTfw = 0.5,
    visualize = False, newObs = False, verbose = False)
tmpMdlDf = tmpMdlDf.append(thsMdlDf)

print '\ntmpMdlDf: '
print(tmpMdlDf)
imported img_glbSpec_SFDD_Img_Sz_64.py

Logistic Regression (TensorFlow): nObsFit:  100; nObsBtc:   16; rotatePby: 0.2000; rotateMaxAgl:  10; nRELUs:   128; nStepsTfw:   10; lrnRateTfw:0.5000 
  visualize: True; newObs: False; verbose: False


max Pby for cls: c0; desc: normal driving; proba: 0.4731; nObs: 1
  img_29701.jpg:
  plot_occlusion:
  Proba:
[ 0.4731  0.0011  0.0016  0.3912  0.0884  0.0083  0.0001  0.0024  0.0029
  0.0309]
min Pby for cls: c0; desc: normal driving; proba: 0.2451; nObs: 1
  img_86363.jpg:
  plot_occlusion:
  Proba:
[ 0.2451  0.1808  0.1241  0.0272  0.2366  0.0868  0.      0.0014  0.0979
  0.0001]
  next best class: talking on the phone - left


max Pby for cls: c1; desc: texting - right; proba: 0.1296; nObs: 1
  img_16842.jpg:
  plot_occlusion:
  Proba:
[ 0.0934  0.1296  0.1011  0.1242  0.1251  0.0779  0.1271  0.0732  0.0901
  0.0583]
min Pby for cls: c1; desc: texting - right; proba: 0.1296; nObs: 1
  img_16842.jpg:
  plot_occlusion:
  Proba:
[ 0.0934  0.1296  0.1011  0.1242  0.1251  0.0779  0.1271  0.0732  0.0901
  0.0583]
  next best class: drinking


max Pby for cls: c2; desc: talking on the phone - right; proba: 1.0000; nObs: 1
  img_18370.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  1.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c2; desc: talking on the phone - right; proba: 0.1228; nObs: 1
  img_13515.jpg:
  plot_occlusion:
  Proba:
[ 0.0934  0.1078  0.1228  0.1172  0.1125  0.0793  0.0984  0.1131  0.0913
  0.0644]
  next best class: texting - left


max Pby for cls: c3; desc: texting - left; proba: 0.9999; nObs: 1
  img_72000.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.0001  0.      0.9999  0.      0.      0.      0.      0.      0.    ]
min Pby for cls: c3; desc: texting - left; proba: 0.1219; nObs: 1
  img_76964.jpg:
  plot_occlusion:
  Proba:
[ 0.0967  0.1072  0.1189  0.1219  0.1147  0.08    0.0947  0.1091  0.0957
  0.061 ]
  next best class: talking on the phone - right


max Pby for cls: c4; desc: talking on the phone - left; proba: 0.2652; nObs: 1
  img_92906.jpg:
  plot_occlusion:
  Proba:
[ 0.0596  0.0551  0.0202  0.0437  0.2652  0.0271  0.0579  0.2334  0.0654
  0.1724]
min Pby for cls: c4; desc: talking on the phone - left; proba: 0.1950; nObs: 1
  img_6011.jpg:
  plot_occlusion:
  Proba:
[ 0.1297  0.0815  0.0446  0.1467  0.195   0.0636  0.0498  0.0894  0.157
  0.0427]
  next best class: hair and makeup


max Pby for cls: c5; desc: operating the radio; proba: 0.8866; nObs: 1
  img_37865.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.      0.      0.013   0.0071  0.8866  0.      0.0931  0.
  0.0001]
min Pby for cls: c5; desc: operating the radio; proba: 0.2829; nObs: 1
  img_91797.jpg:
  plot_occlusion:
  Proba:
[ 0.0257  0.0457  0.008   0.15    0.1353  0.2829  0.0408  0.2654  0.0017
  0.0444]
  next best class: reaching behind


max Pby for cls: c6; desc: drinking; proba: 0.4756; nObs: 1
  img_73039.jpg:
  plot_occlusion:
  Proba:
[ 0.0008  0.0374  0.4318  0.0005  0.0522  0.0002  0.4756  0.0005  0.0003
  0.0007]
min Pby for cls: c6; desc: drinking; proba: 0.4756; nObs: 1
  img_73039.jpg:
  plot_occlusion:
  Proba:
[ 0.0008  0.0374  0.4318  0.0005  0.0522  0.0002  0.4756  0.0005  0.0003
  0.0007]
  next best class: talking on the phone - right


max Pby for cls: c7; desc: reaching behind; proba: 1.0000; nObs: 1
  img_23350.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
min Pby for cls: c7; desc: reaching behind; proba: 0.1256; nObs: 1
  img_82894.jpg:
  plot_occlusion:
  Proba:
[ 0.0468  0.1116  0.1004  0.0823  0.0998  0.0936  0.1164  0.1256  0.125
  0.0985]
  next best class: hair and makeup


max Pby for cls: c8; desc: hair and makeup; proba: 1.0000; nObs: 1
  img_7407.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  1.  0.]
min Pby for cls: c8; desc: hair and makeup; proba: 0.1323; nObs: 1
  img_3899.jpg:
  plot_occlusion:
  Proba:
[ 0.0433  0.1114  0.0961  0.0796  0.0987  0.0957  0.1166  0.1249  0.1323
  0.1013]
  next best class: reaching behind


max Pby for cls: c9; desc: talking to passenger; proba: 0.4900; nObs: 1
  img_36711.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.0061  0.0001  0.      0.0001  0.0424  0.      0.0018  0.4594
  0.49  ]
min Pby for cls: c9; desc: talking to passenger; proba: 0.4900; nObs: 1
  img_36711.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.0061  0.0001  0.      0.0001  0.0424  0.      0.0018  0.4594
  0.49  ]
  next best class: hair and makeup
  duration: 45 seconds

Logistic Regression (TensorFlow): nObsFit:  100; nObsBtc:   16; rotatePby: 0.2000; rotateMaxAgl:  10; nRELUs:   128; nStepsTfw:   10; lrnRateTfw:0.5000 
  visualize: False; newObs: True; verbose: False
  predicting 79726 new obs...
  duration: 23 seconds

Logistic Regression (TensorFlow): nObsFit:  100; nObsBtc:   16; rotatePby: 0.2000; rotateMaxAgl:  10; nRELUs:   128; nStepsTfw:   10; lrnRateTfw:0.5000 
  visualize: False; newObs: False; verbose: True
('  tfwW1:', <tf.Tensor 'Identity:0' shape=(4096, 128) dtype=float32>)
('  tfwB1:', <tf.Tensor 'Identity_1:0' shape=(128,) dtype=float32>)
('  tfwW3:', <tf.Tensor 'Identity_2:0' shape=(128, 10) dtype=float32>)
('  tfwB3:', <tf.Tensor 'Identity_3:0' shape=(10,) dtype=float32>)
  Initialized
  step     1(    0 secs): Minibatch rotation:angle: 3.9074
  step     6(    0 secs): Minibatch rotation:angle: 6.9499

  Vld accuracy:0.1107
[ 0.      0.      0.9602  0.0158  0.      0.      0.0023  0.0171  0.0879
  0.0022]
[[  0   0 377  23   0   0   0   3  81   0]
 [  1   0 419  44   2   0   0   0  12   0]
 [  0   0 434   4   0   0   0   4  10   0]
 [  0   0 416   7   0   0   0   4  16   0]
 [  0   0 454   3   0   2   0   0   0   0]
 [  0   0 388   9   0   0   0   1  24   0]
 [  1   0 393  15   1   0   1   2  30   0]
 [  1   0 216  40   0   6   0   6  81   0]
 [  0   0 316   9   0   0   0   7  32   0]
 [  0   1 375  19   0   6   0   2  48   1]]
  Vld  logLoss:2.7317
[ 0.295   0.2562  0.2235  0.2323  0.2393  0.2725  0.2714  0.3345  0.1999
  0.4071]
  duration: 01 seconds

Logistic Regression (TensorFlow): nObsFit:  100; nObsBtc:   16; rotatePby: 0.2000; rotateMaxAgl:  10; nRELUs:   128; nStepsTfw:   10; lrnRateTfw:0.5000 
  visualize: False; newObs: False; verbose: False
  duration: 01 seconds

tmpMdlDf: 
     accVld                                          accVldCls  duration  \
0  0.110651  {u'accCls': [0.0, 0.0, 0.96017699115, 0.015801...        45   
0  0.110651  {u'accCls': [0.0, 0.0, 0.96017699115, 0.015801...        23   
0  0.110651  {u'accCls': [0.0, 0.0, 0.96017699115, 0.015801...         1   
0  0.110651  {u'accCls': [0.0, 0.0, 0.96017699115, 0.015801...         1   

            id  logLossVld                                      logLossVldCls  \
0  MLP.SGD.tfw    2.731677  {u'logLossCls': [0.294985288628, 0.25619677152...   
0  MLP.SGD.tfw    2.731677  {u'logLossCls': [0.294985288628, 0.25619677152...   
0  MLP.SGD.tfw    2.731677  {u'logLossCls': [0.294985288628, 0.25619677152...   
0  MLP.SGD.tfw    2.731677  {u'logLossCls': [0.294985288628, 0.25619677152...   

   lrnRateTfw                                              model  nObsBtc  \
0         0.5  <tensorflow.python.client.session.Session obje...       16   
0         0.5  <tensorflow.python.client.session.Session obje...       16   
0         0.5  <tensorflow.python.client.session.Session obje...       16   
0         0.5  <tensorflow.python.client.session.Session obje...       16   

   nObsFit  nRELUs  nStepsTfw  \
0      100     128         10   
0      100     128         10   
0      100     128         10   
0      100     128         10   

                                             predNew  rotateMaxAgl  rotatePby  
0                                                NaN            10        0.2  
0  {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...            10        0.2  
0                                                NaN            10        0.2  
0                                                NaN            10        0.2  
In [10]:
# glbMdlDf = None
# glbMdlDf = pd.DataFrame()

try:
    with open(glbPickleFile['models'], 'rb') as f:
        glbMdlDf = pickle.load(f)
        assert isinstance(glbMdlDf, pd.DataFrame), \
            'type(glbMdlDf): %s, expecting pd.DataFrame' % \
            (str(type(glbMdlDf)))            
except IOError, e:
    print e
    print 'file %s not present or not appropriate' % \
        (glbPickleFile['models'])        
print glbMdlDf
                                                                                     accVld  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0             1.000000   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0             0.987348   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2             0.833218   
                1000.0   18077.0 0      0.1       8.0      3.00      2             0.381643   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0             0.375201   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2             0.361859   
                                                           2.00      1             0.357488   
                                        0.0       8.0      3.00      0             0.357028   
                                                                     2             0.357028   
                                                                     1             0.357028   
                                                                     10            0.357028   
                                        0.1       8.0      3.00      0             0.357028   
                                                  4.0      1.00      1             0.355648   
                                                  8.0      2.00      2             0.351737   
                                                                     4             0.348516   
                                                  16.0     4.00      10            0.346216   
                                        0.0       8.0      7.00      10            0.346216   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0             0.343685   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10            0.338854   
                                                                     1             0.338854   
                                                  8.0      5.00      10            0.336784   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2             0.335864   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10            0.334484   
                                                  16.0     4.00      10            0.331723   
                                        0.0       8.0      1.00      0             0.331493   
                                                                     1             0.331493   
                                                                     2             0.331493   
                                                                     10            0.331493   
                                        0.1       8.0      1.00      0             0.331493   
                                        0.0       32.0     1.00      10            0.328042   
...                                                                                     ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2             0.101909   
                                 128    0.1       8.0      3.00      2             0.101909   
                                 16     0.1       8.0      4.00      2             0.101909   
                4520.0   18077.0 128    0.1       4.0      3.00      2             0.101909   
                2260.0   18077.0 64     0.1       8.0      0.50      2             0.101449   
                                 128    0.1       16.0     3.00      2             0.096848   
                                 256    0.1       16.0     3.00      2             0.096848   
                                 512    0.1       16.0     3.00      2             0.096848   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0             0.342535   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0             0.384173   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2             0.381643   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0             0.358638   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0             0.319991   
                                                           0.10      0             0.251208   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10            0.210950   
                1000.0   9000.0  0      0.1       8.0      3.00      2             0.381643   
                         8000.0  0      0.1       8.0      3.00      2             0.378882   
                         7000.0  0      0.1       8.0      3.00      2             0.375431   
                         6000.0  0      0.1       8.0      3.00      2             0.339545   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0             0.363699   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2             0.320911   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0             0.341385   
                         1000.0  0      0.0       1000.0  -1.00      0             0.333333   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0             0.273522   
                                                           1.00      0             0.255809   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2             0.224983   
                100.0    1000.0  0      0.1       16.0     1.00      10            0.212790   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0             0.173453   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0             0.307108   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2             0.224753   

                                                                                                                           accVldCls  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0                                                           NaN   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0             {u'accCls': [0.989669421488, 0.991631799163, 0...   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2             {u'accCls': [0.704545454545, 0.910041841004, 0...   
                1000.0   18077.0 0      0.1       8.0      3.00      2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0             {u'accCls': [0.504132231405, 0.435146443515, 0...   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2             {u'accCls': [0.448347107438, 0.44769874477, 0....   
                                                           2.00      1             {u'accCls': [0.338842975207, 0.347280334728, 0...   
                                        0.0       8.0      3.00      0             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                                     2             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                                     1             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                                     10            {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                        0.1       8.0      3.00      0             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                  4.0      1.00      1             {u'accCls': [0.52479338843, 0.575313807531, 0....   
                                                  8.0      2.00      2             {u'accCls': [0.146694214876, 0.5, 0.2123893805...   
                                                                     4             {u'accCls': [0.384297520661, 0.297071129707, 0...   
                                                  16.0     4.00      10            {u'accCls': [0.510330578512, 0.389121338912, 0...   
                                        0.0       8.0      7.00      10            {u'accCls': [0.421487603306, 0.410041841004, 0...   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10            {u'accCls': [0.506198347107, 0.644351464435, 0...   
                                                                     1             {u'accCls': [0.506198347107, 0.644351464435, 0...   
                                                  8.0      5.00      10            {u'accCls': [0.338842975207, 0.173640167364, 0...   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2             {u'accCls': [0.576446280992, 0.278242677824, 0...   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10            {u'accCls': [0.421487603306, 0.558577405858, 0...   
                                                  16.0     4.00      10            {u'accCls': [0.396694214876, 0.0836820083682, ...   
                                        0.0       8.0      1.00      0             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                                     1             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                                     2             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                                                     10            {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                        0.1       8.0      1.00      0             {u'accCls': [0.25, 0.246861924686, 0.303097345...   
                                        0.0       32.0     1.00      10            {u'accCls': [0.588842975207, 0.133891213389, 0...   
...                                                                                                                              ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2             {u'accCls': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0...   
                                 128    0.1       8.0      3.00      2             {u'accCls': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0...   
                                 16     0.1       8.0      4.00      2             {u'accCls': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0...   
                4520.0   18077.0 128    0.1       4.0      3.00      2             {u'accCls': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0...   
                2260.0   18077.0 64     0.1       8.0      0.50      2             {u'accCls': [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.9...   
                                 128    0.1       16.0     3.00      2             {u'accCls': [0.0, 0.0, 0.0, 0.0, 0.0, 0.997630...   
                                 256    0.1       16.0     3.00      2             {u'accCls': [0.0, 0.0, 0.0, 0.0, 0.0, 0.997630...   
                                 512    0.1       16.0     3.00      2             {u'accCls': [0.0, 0.0, 0.0, 0.0, 0.0, 0.997630...   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0             {u'accCls': [0.456611570248, 0.380753138075, 0...   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0             {u'accCls': [0.289256198347, 0.182008368201, 0...   
                                                           0.10      0             {u'accCls': [0.169421487603, 0.144351464435, 0...   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10            {u'accCls': [0.0, 0.150627615063, 0.0, 0.00225...   
                1000.0   9000.0  0      0.1       8.0      3.00      2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
                         8000.0  0      0.1       8.0      3.00      2             {u'accCls': [0.553719008264, 0.610878661088, 0...   
                         7000.0  0      0.1       8.0      3.00      2             {u'accCls': [0.431818181818, 0.558577405858, 0...   
                         6000.0  0      0.1       8.0      3.00      2             {u'accCls': [0.181818181818, 0.671548117155, 0...   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2             {u'accCls': [0.543388429752, 0.535564853556, 0...   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0                                                           NaN   
                         1000.0  0      0.0       1000.0  -1.00      0                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0             {u'accCls': [0.646694214876, 0.0564853556485, ...   
                                                           1.00      0             {u'accCls': [0.423553719008, 0.182008368201, 0...   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2             {u'accCls': [0.204545454545, 0.0334728033473, ...   
                100.0    1000.0  0      0.1       16.0     1.00      10            {u'accCls': [0.136363636364, 0.0230125523013, ...   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0             {u'accCls': [0.150826446281, 0.142259414226, 0...   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2             {u'accCls': [0.0185950413223, 0.133891213389, ...   

                                                                                  bestFit  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0              False   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0              False   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2              False   
                1000.0   18077.0 0      0.1       8.0      3.00      2               True   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2              False   
                                                           2.00      1              False   
                                        0.0       8.0      3.00      0              False   
                                                                     2              False   
                                                                     1              False   
                                                                     10             False   
                                        0.1       8.0      3.00      0              False   
                                                  4.0      1.00      1              False   
                                                  8.0      2.00      2              False   
                                                                     4              False   
                                                  16.0     4.00      10             False   
                                        0.0       8.0      7.00      10             False   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10             False   
                                                                     1              False   
                                                  8.0      5.00      10             False   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10             False   
                                                  16.0     4.00      10             False   
                                        0.0       8.0      1.00      0              False   
                                                                     1              False   
                                                                     2              False   
                                                                     10             False   
                                        0.1       8.0      1.00      0              False   
                                        0.0       32.0     1.00      10             False   
...                                                                                   ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2              False   
                                 128    0.1       8.0      3.00      2              False   
                                 16     0.1       8.0      4.00      2              False   
                4520.0   18077.0 128    0.1       4.0      3.00      2              False   
                2260.0   18077.0 64     0.1       8.0      0.50      2              False   
                                 128    0.1       16.0     3.00      2              False   
                                 256    0.1       16.0     3.00      2              False   
                                 512    0.1       16.0     3.00      2              False   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0              False   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0              False   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2              False   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0              False   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0              False   
                                                           0.10      0              False   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10             False   
                1000.0   9000.0  0      0.1       8.0      3.00      2              False   
                         8000.0  0      0.1       8.0      3.00      2              False   
                         7000.0  0      0.1       8.0      3.00      2              False   
                         6000.0  0      0.1       8.0      3.00      2              False   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0              False   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2              False   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0              False   
                         1000.0  0      0.0       1000.0  -1.00      0              False   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0              False   
                                                           1.00      0              False   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2              False   
                100.0    1000.0  0      0.1       16.0     1.00      10             False   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0              False   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0              False   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2              False   

                                                                                   duration  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0                  874   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0                  743   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2                  122   
                1000.0   18077.0 0      0.1       8.0      3.00      2                   11   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0                  519   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2                    9   
                                                           2.00      1                   10   
                                        0.0       8.0      3.00      0                    8   
                                                                     2                    8   
                                                                     1                    9   
                                                                     10                  10   
                                        0.1       8.0      3.00      0                   10   
                                                  4.0      1.00      1                    8   
                                                  8.0      2.00      2                   10   
                                                                     4                   13   
                                                  16.0     4.00      10                  14   
                                        0.0       8.0      7.00      10                   9   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0                  597   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10                   8   
                                                                     1                    8   
                                                  8.0      5.00      10                   9   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2                   54   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10                  15   
                                                  16.0     4.00      10                  24   
                                        0.0       8.0      1.00      0                    8   
                                                                     1                    8   
                                                                     2                    8   
                                                                     10                   9   
                                        0.1       8.0      1.00      0                   13   
                                        0.0       32.0     1.00      10                  16   
...                                                                                     ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2                   77   
                                 128    0.1       8.0      3.00      2                   48   
                                 16     0.1       8.0      4.00      2                   26   
                4520.0   18077.0 128    0.1       4.0      3.00      2                   87   
                2260.0   18077.0 64     0.1       8.0      0.50      2                   41   
                                 128    0.1       16.0     3.00      2                   55   
                                 256    0.1       16.0     3.00      2                   57   
                                 512    0.1       16.0     3.00      2                   67   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0                  514   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0                  288   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2                    9   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0                  317   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0                  301   
                                                           0.10      0                  295   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10                   2   
                1000.0   9000.0  0      0.1       8.0      3.00      2                    9   
                         8000.0  0      0.1       8.0      3.00      2                    9   
                         7000.0  0      0.1       8.0      3.00      2                    9   
                         6000.0  0      0.1       8.0      3.00      2                    9   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0                  150   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2                    9   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0                   55   
                         1000.0  0      0.0       1000.0  -1.00      0                   28   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0                    7   
                                                           1.00      0                    5   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2                    9   
                100.0    1000.0  0      0.1       16.0     1.00      10                   2   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0                    5   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0                    8   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2                    9   

                                                                                               id  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                   
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0                 LgtRgr.skl   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2             LgtRgr.SGD.tfw   
                1000.0   18077.0 0      0.1       8.0      3.00      2             LgtRgr.SGD.tfw   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2             LgtRgr.SGD.tfw   
                                                           2.00      1             LgtRgr.SGD.tfw   
                                        0.0       8.0      3.00      0             LgtRgr.SGD.tfw   
                                                                     2             LgtRgr.SGD.tfw   
                                                                     1             LgtRgr.SGD.tfw   
                                                                     10            LgtRgr.SGD.tfw   
                                        0.1       8.0      3.00      0             LgtRgr.SGD.tfw   
                                                  4.0      1.00      1             LgtRgr.SGD.tfw   
                                                  8.0      2.00      2             LgtRgr.SGD.tfw   
                                                                     4             LgtRgr.SGD.tfw   
                                                  16.0     4.00      10            LgtRgr.SGD.tfw   
                                        0.0       8.0      7.00      10            LgtRgr.SGD.tfw   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0                 LgtRgr.skl   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10            LgtRgr.SGD.tfw   
                                                                     1             LgtRgr.SGD.tfw   
                                                  8.0      5.00      10            LgtRgr.SGD.tfw   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2                MLP.SGD.tfw   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10            LgtRgr.SGD.tfw   
                                                  16.0     4.00      10            LgtRgr.SGD.tfw   
                                        0.0       8.0      1.00      0             LgtRgr.SGD.tfw   
                                                                     1             LgtRgr.SGD.tfw   
                                                                     2             LgtRgr.SGD.tfw   
                                                                     10            LgtRgr.SGD.tfw   
                                        0.1       8.0      1.00      0             LgtRgr.SGD.tfw   
                                        0.0       32.0     1.00      10            LgtRgr.SGD.tfw   
...                                                                                           ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2                MLP.SGD.tfw   
                                 128    0.1       8.0      3.00      2                MLP.SGD.tfw   
                                 16     0.1       8.0      4.00      2                MLP.SGD.tfw   
                4520.0   18077.0 128    0.1       4.0      3.00      2                MLP.SGD.tfw   
                2260.0   18077.0 64     0.1       8.0      0.50      2                MLP.SGD.tfw   
                                 128    0.1       16.0     3.00      2                MLP.SGD.tfw   
                                 256    0.1       16.0     3.00      2                MLP.SGD.tfw   
                                 512    0.1       16.0     3.00      2                MLP.SGD.tfw   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0                 LgtRgr.skl   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2             LgtRgr.SGD.tfw   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0                 LgtRgr.skl   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0                 LgtRgr.tfw   
                                                           0.10      0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10            LgtRgr.SGD.tfw   
                1000.0   9000.0  0      0.1       8.0      3.00      2             LgtRgr.SGD.tfw   
                         8000.0  0      0.1       8.0      3.00      2             LgtRgr.SGD.tfw   
                         7000.0  0      0.1       8.0      3.00      2             LgtRgr.SGD.tfw   
                         6000.0  0      0.1       8.0      3.00      2             LgtRgr.SGD.tfw   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0                 LgtRgr.skl   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2             LgtRgr.SGD.tfw   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0                 LgtRgr.skl   
                         1000.0  0      0.0       1000.0  -1.00      0                 LgtRgr.skl   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0                 LgtRgr.tfw   
                                                           1.00      0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2             LgtRgr.SGD.tfw   
                100.0    1000.0  0      0.1       16.0     1.00      10            LgtRgr.SGD.tfw   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0                 LgtRgr.tfw   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0                 LgtRgr.skl   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2             LgtRgr.SGD.tfw   

                                                                                   logLossVld  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0               0.018463   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0               0.193149   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2               4.836929   
                1000.0   18077.0 0      0.1       8.0      3.00      2              20.546733   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0              19.209913   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2              17.898932   
                                                           2.00      1              20.091985   
                                        0.0       8.0      3.00      0              20.948740   
                                                                     2              20.948740   
                                                                     1              20.948740   
                                                                     10             20.948740   
                                        0.1       8.0      3.00      0              20.948740   
                                                  4.0      1.00      1              19.602959   
                                                  8.0      2.00      2              19.997834   
                                                                     4              20.635511   
                                                  16.0     4.00      10             21.347350   
                                        0.0       8.0      7.00      10             21.886713   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0               3.116799   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10             22.423282   
                                                                     1              22.423282   
                                                  8.0      5.00      10             22.167039   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2              19.782698   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10             22.007029   
                                                  16.0     4.00      10             21.561740   
                                        0.0       8.0      1.00      0              19.594075   
                                                                     1              19.594075   
                                                                     2              19.594075   
                                                                     10             19.594075   
                                        0.1       8.0      1.00      0              19.594075   
                                        0.0       32.0     1.00      10             16.835064   
...                                                                                       ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2               2.457509   
                                 128    0.1       8.0      3.00      2               2.464654   
                                 16     0.1       8.0      4.00      2               2.478298   
                4520.0   18077.0 128    0.1       4.0      3.00      2               2.529923   
                2260.0   18077.0 64     0.1       8.0      0.50      2               2.335875   
                                 128    0.1       16.0     3.00      2               2.377584   
                                 256    0.1       16.0     3.00      2               2.377584   
                                 512    0.1       16.0     3.00      2               2.377584   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0               3.085191   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0              18.995890   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2              20.546733   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0               2.885114   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0               9.502959   
                                                           0.10      0               8.912652   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10             24.085776   
                1000.0   9000.0  0      0.1       8.0      3.00      2              20.546733   
                         8000.0  0      0.1       8.0      3.00      2              20.345963   
                         7000.0  0      0.1       8.0      3.00      2              20.307083   
                         6000.0  0      0.1       8.0      3.00      2              21.354761   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0               2.610439   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2              21.899301   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0               2.498749   
                         1000.0  0      0.0       1000.0  -1.00      0               2.539650   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0              24.274683   
                                                           1.00      0              14.714048   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2              25.728109   
                100.0    1000.0  0      0.1       16.0     1.00      10             18.141110   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0              12.600104   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0               2.497940   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2              25.837055   

                                                                                                                       logLossVldCls  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0                                                           NaN   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0             {u'logLossCls': [0.0123335882818, 0.0241534716...   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2             {u'logLossCls': [0.973879753517, 0.22334474905...   
                1000.0   18077.0 0      0.1       8.0      3.00      2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0             {u'logLossCls': [1.72596805748, 1.7853875361, ...   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2             {u'logLossCls': [1.7477126908, 1.45845704706, ...   
                                                           2.00      1             {u'logLossCls': [2.4098162987, 2.1249522721, 2...   
                                        0.0       8.0      3.00      0             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                                     2             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                                     1             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                                     10            {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                        0.1       8.0      3.00      0             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                  4.0      1.00      1             {u'logLossCls': [1.47759900586, 1.5216033003, ...   
                                                  8.0      2.00      2             {u'logLossCls': [2.96027056113, 1.55809628297,...   
                                                                     4             {u'logLossCls': [2.1684078246, 2.40346788464, ...   
                                                  16.0     4.00      10            {u'logLossCls': [1.79621628564, 1.99717570497,...   
                                        0.0       8.0      7.00      10            {u'logLossCls': [2.16842694926, 2.08737047825,...   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10            {u'logLossCls': [1.82392002827, 1.3175497433, ...   
                                                                     1             {u'logLossCls': [1.82392002827, 1.3175497433, ...   
                                                  8.0      5.00      10            {u'logLossCls': [2.49658612049, 3.01094383144,...   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2             {u'logLossCls': [1.38497343758, 2.23958887677,...   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10            {u'logLossCls': [2.1293109356, 1.52307431523, ...   
                                                  16.0     4.00      10            {u'logLossCls': [2.13819531033, 3.35150390363,...   
                                        0.0       8.0      1.00      0             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                                     1             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                                     2             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                                                     10            {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                        0.1       8.0      1.00      0             {u'logLossCls': [2.37109926898, 2.31826985925,...   
                                        0.0       32.0     1.00      10            {u'logLossCls': [1.3367673536, 2.19949472069, ...   
...                                                                                                                              ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2             {u'logLossCls': [0.27374933863, 0.216602887855...   
                                 128    0.1       8.0      3.00      2             {u'logLossCls': [0.273882728887, 0.21660288785...   
                                 16     0.1       8.0      4.00      2             {u'logLossCls': [0.285150985671, 0.20472783558...   
                4520.0   18077.0 128    0.1       4.0      3.00      2             {u'logLossCls': [0.278653, 0.210546, 0.219029,...   
                2260.0   18077.0 64     0.1       8.0      0.50      2             {u'logLossCls': [0.229419320283, 0.25757370666...   
                                 128    0.1       16.0     3.00      2             {u'logLossCls': [0.258817712677, 0.27630619320...   
                                 256    0.1       16.0     3.00      2             {u'logLossCls': [0.258817712677, 0.27630619320...   
                                 512    0.1       16.0     3.00      2             {u'logLossCls': [0.258817712677, 0.27630619320...   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0             {u'logLossCls': [1.84540699409, 1.93896956479,...   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0             {u'logLossCls': [1.14059053163, 1.46723165909,...   
                                                           0.10      0             {u'logLossCls': [1.11536194976, 1.25718941188,...   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10            {u'logLossCls': [3.84558724986, 2.69565642157,...   
                1000.0   9000.0  0      0.1       8.0      3.00      2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
                         8000.0  0      0.1       8.0      3.00      2             {u'logLossCls': [1.5257602538, 1.31972597838, ...   
                         7000.0  0      0.1       8.0      3.00      2             {u'logLossCls': [2.06754908637, 1.51088086827,...   
                         6000.0  0      0.1       8.0      3.00      2             {u'logLossCls': [2.97387028973, 1.20522205183,...   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2             {u'logLossCls': [1.57533202071, 1.59023941247,...   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0                                                           NaN   
                         1000.0  0      0.0       1000.0  -1.00      0                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0             {u'logLossCls': [1.28781316316, 3.51519487621,...   
                                                           1.00      0             {u'logLossCls': [0.842354858019, 1.17531354279...   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2             {u'logLossCls': [2.84808429073, 3.58756550329,...   
                100.0    1000.0  0      0.1       16.0     1.00      10            {u'logLossCls': [2.1826821181, 3.34540505739, ...   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0             {u'logLossCls': [1.47411393905, 2.08387227918,...   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2             {u'logLossCls': [3.67759601248, 3.22267129616,...   

                                                                                   lrnRateTfw  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0                  -1.00   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0                  10.00   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2                   3.00   
                1000.0   18077.0 0      0.1       8.0      3.00      2                   3.00   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0                  10.00   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2                   1.00   
                                                           2.00      1                   2.00   
                                        0.0       8.0      3.00      0                   3.00   
                                                                     2                   3.00   
                                                                     1                   3.00   
                                                                     10                  3.00   
                                        0.1       8.0      3.00      0                   3.00   
                                                  4.0      1.00      1                   1.00   
                                                  8.0      2.00      2                   2.00   
                                                                     4                   2.00   
                                                  16.0     4.00      10                  4.00   
                                        0.0       8.0      7.00      10                  7.00   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0                  -1.00   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10                  4.00   
                                                                     1                   4.00   
                                                  8.0      5.00      10                  5.00   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2                   0.01   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10                  4.00   
                                                  16.0     4.00      10                  4.00   
                                        0.0       8.0      1.00      0                   1.00   
                                                                     1                   1.00   
                                                                     2                   1.00   
                                                                     10                  1.00   
                                        0.1       8.0      1.00      0                   1.00   
                                        0.0       32.0     1.00      10                  1.00   
...                                                                                       ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2                   3.00   
                                 128    0.1       8.0      3.00      2                   3.00   
                                 16     0.1       8.0      4.00      2                   4.00   
                4520.0   18077.0 128    0.1       4.0      3.00      2                   3.00   
                2260.0   18077.0 64     0.1       8.0      0.50      2                   0.50   
                                 128    0.1       16.0     3.00      2                   3.00   
                                 256    0.1       16.0     3.00      2                   3.00   
                                 512    0.1       16.0     3.00      2                   3.00   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0                  -1.00   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0                  10.00   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2                   3.00   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0                  -1.00   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0                   1.00   
                                                           0.10      0                   0.10   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10                  1.00   
                1000.0   9000.0  0      0.1       8.0      3.00      2                   3.00   
                         8000.0  0      0.1       8.0      3.00      2                   3.00   
                         7000.0  0      0.1       8.0      3.00      2                   3.00   
                         6000.0  0      0.1       8.0      3.00      2                   3.00   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0                  -1.00   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2                   3.00   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0                  -1.00   
                         1000.0  0      0.0       1000.0  -1.00      0                  -1.00   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0                  10.00   
                                                           1.00      0                   1.00   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2                   3.00   
                100.0    1000.0  0      0.1       16.0     1.00      10                  1.00   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0                   0.10   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0                  -1.00   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2                   3.00   

                                                                                   nObsBtc  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0             22424.0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0             22424.0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2                 8.0   
                1000.0   18077.0 0      0.1       8.0      3.00      2                 8.0   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0             18077.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2                 8.0   
                                                           2.00      1                 8.0   
                                        0.0       8.0      3.00      0                 8.0   
                                                                     2                 8.0   
                                                                     1                 8.0   
                                                                     10                8.0   
                                        0.1       8.0      3.00      0                 8.0   
                                                  4.0      1.00      1                 4.0   
                                                  8.0      2.00      2                 8.0   
                                                                     4                 8.0   
                                                  16.0     4.00      10               16.0   
                                        0.0       8.0      7.00      10                8.0   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0             18077.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10                4.0   
                                                                     1                 4.0   
                                                  8.0      5.00      10                8.0   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2                 8.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10                8.0   
                                                  16.0     4.00      10               16.0   
                                        0.0       8.0      1.00      0                 8.0   
                                                                     1                 8.0   
                                                                     2                 8.0   
                                                                     10                8.0   
                                        0.1       8.0      1.00      0                 8.0   
                                        0.0       32.0     1.00      10               32.0   
...                                                                                    ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2                 8.0   
                                 128    0.1       8.0      3.00      2                 8.0   
                                 16     0.1       8.0      4.00      2                 8.0   
                4520.0   18077.0 128    0.1       4.0      3.00      2                 4.0   
                2260.0   18077.0 64     0.1       8.0      0.50      2                 8.0   
                                 128    0.1       16.0     3.00      2                16.0   
                                 256    0.1       16.0     3.00      2                16.0   
                                 512    0.1       16.0     3.00      2                16.0   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0             15000.0   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0             10000.0   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2                 8.0   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0             10000.0   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0             10000.0   
                                                           0.10      0             10000.0   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10               16.0   
                1000.0   9000.0  0      0.1       8.0      3.00      2                 8.0   
                         8000.0  0      0.1       8.0      3.00      2                 8.0   
                         7000.0  0      0.1       8.0      3.00      2                 8.0   
                         6000.0  0      0.1       8.0      3.00      2                 8.0   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0              5000.0   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2                 8.0   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0              2000.0   
                         1000.0  0      0.0       1000.0  -1.00      0              1000.0   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0              1000.0   
                                                           1.00      0              1000.0   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2                 8.0   
                100.0    1000.0  0      0.1       16.0     1.00      10               16.0   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0              1000.0   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0               100.0   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2                 8.0   

                                                                                   nObsFit  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0             22424.0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0             22424.0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2             22424.0   
                1000.0   18077.0 0      0.1       8.0      3.00      2             18077.0   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0             18077.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2             18077.0   
                                                           2.00      1             18077.0   
                                        0.0       8.0      3.00      0             18077.0   
                                                                     2             18077.0   
                                                                     1             18077.0   
                                                                     10            18077.0   
                                        0.1       8.0      3.00      0             18077.0   
                                                  4.0      1.00      1             18077.0   
                                                  8.0      2.00      2             18077.0   
                                                                     4             18077.0   
                                                  16.0     4.00      10            18077.0   
                                        0.0       8.0      7.00      10            18077.0   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0             18077.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10            18077.0   
                                                                     1             18077.0   
                                                  8.0      5.00      10            18077.0   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2             18077.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10            18077.0   
                                                  16.0     4.00      10            18077.0   
                                        0.0       8.0      1.00      0             18077.0   
                                                                     1             18077.0   
                                                                     2             18077.0   
                                                                     10            18077.0   
                                        0.1       8.0      1.00      0             18077.0   
                                        0.0       32.0     1.00      10            18077.0   
...                                                                                    ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2             18077.0   
                                 128    0.1       8.0      3.00      2             18077.0   
                                 16     0.1       8.0      4.00      2             18077.0   
                4520.0   18077.0 128    0.1       4.0      3.00      2             18077.0   
                2260.0   18077.0 64     0.1       8.0      0.50      2             18077.0   
                                 128    0.1       16.0     3.00      2             18077.0   
                                 256    0.1       16.0     3.00      2             18077.0   
                                 512    0.1       16.0     3.00      2             18077.0   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0             15000.0   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0             10000.0   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2             10000.0   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0             10000.0   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0             10000.0   
                                                           0.10      0             10000.0   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10            10000.0   
                1000.0   9000.0  0      0.1       8.0      3.00      2              9000.0   
                         8000.0  0      0.1       8.0      3.00      2              8000.0   
                         7000.0  0      0.1       8.0      3.00      2              7000.0   
                         6000.0  0      0.1       8.0      3.00      2              6000.0   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0              5000.0   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2              5000.0   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0              2000.0   
                         1000.0  0      0.0       1000.0  -1.00      0              1000.0   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0              1000.0   
                                                           1.00      0              1000.0   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2              1000.0   
                100.0    1000.0  0      0.1       16.0     1.00      10             1000.0   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0              1000.0   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0               100.0   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2               100.0   

                                                                                  nRELUs  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl          
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0                 0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0                 0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2                 0   
                1000.0   18077.0 0      0.1       8.0      3.00      2                 0   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0                 0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2                 0   
                                                           2.00      1                 0   
                                        0.0       8.0      3.00      0                 0   
                                                                     2                 0   
                                                                     1                 0   
                                                                     10                0   
                                        0.1       8.0      3.00      0                 0   
                                                  4.0      1.00      1                 0   
                                                  8.0      2.00      2                 0   
                                                                     4                 0   
                                                  16.0     4.00      10                0   
                                        0.0       8.0      7.00      10                0   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0                 0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10                0   
                                                                     1                 0   
                                                  8.0      5.00      10                0   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2               512   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10                0   
                                                  16.0     4.00      10                0   
                                        0.0       8.0      1.00      0                 0   
                                                                     1                 0   
                                                                     2                 0   
                                                                     10                0   
                                        0.1       8.0      1.00      0                 0   
                                        0.0       32.0     1.00      10                0   
...                                                                                  ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2              1024   
                                 128    0.1       8.0      3.00      2               128   
                                 16     0.1       8.0      4.00      2                16   
                4520.0   18077.0 128    0.1       4.0      3.00      2               128   
                2260.0   18077.0 64     0.1       8.0      0.50      2                64   
                                 128    0.1       16.0     3.00      2               128   
                                 256    0.1       16.0     3.00      2               256   
                                 512    0.1       16.0     3.00      2               512   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0                 0   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0                 0   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2                 0   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0                 0   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0                 0   
                                                           0.10      0                 0   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10                0   
                1000.0   9000.0  0      0.1       8.0      3.00      2                 0   
                         8000.0  0      0.1       8.0      3.00      2                 0   
                         7000.0  0      0.1       8.0      3.00      2                 0   
                         6000.0  0      0.1       8.0      3.00      2                 0   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0                 0   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2                 0   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0                 0   
                         1000.0  0      0.0       1000.0  -1.00      0                 0   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0                 0   
                                                           1.00      0                 0   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2                 0   
                100.0    1000.0  0      0.1       16.0     1.00      10                0   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0                 0   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0                 0   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2                 0   

                                                                                   nStepsTfw  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl              
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0                  -1.0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0                1000.0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2                2804.0   
                1000.0   18077.0 0      0.1       8.0      3.00      2                1000.0   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0                1000.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2                1000.0   
                                                           2.00      1                1000.0   
                                        0.0       8.0      3.00      0                1000.0   
                                                                     2                1000.0   
                                                                     1                1000.0   
                                                                     10               1000.0   
                                        0.1       8.0      3.00      0                1000.0   
                                                  4.0      1.00      1                1000.0   
                                                  8.0      2.00      2                1000.0   
                                                                     4                1000.0   
                                                  16.0     4.00      10               1000.0   
                                        0.0       8.0      7.00      10               1000.0   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0                  -1.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10               1000.0   
                                                                     1                1000.0   
                                                  8.0      5.00      10               1000.0   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2                2260.0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10               1000.0   
                                                  16.0     4.00      10               1000.0   
                                        0.0       8.0      1.00      0                1000.0   
                                                                     1                1000.0   
                                                                     2                1000.0   
                                                                     10               1000.0   
                                        0.1       8.0      1.00      0                1000.0   
                                        0.0       32.0     1.00      10               1000.0   
...                                                                                      ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2                2260.0   
                                 128    0.1       8.0      3.00      2                2260.0   
                                 16     0.1       8.0      4.00      2                2260.0   
                4520.0   18077.0 128    0.1       4.0      3.00      2                4520.0   
                2260.0   18077.0 64     0.1       8.0      0.50      2                2260.0   
                                 128    0.1       16.0     3.00      2                2260.0   
                                 256    0.1       16.0     3.00      2                2260.0   
                                 512    0.1       16.0     3.00      2                2260.0   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0                  -1.0   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0                1000.0   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2                1000.0   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0                  -1.0   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0                1000.0   
                                                           0.10      0                1000.0   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10                100.0   
                1000.0   9000.0  0      0.1       8.0      3.00      2                1000.0   
                         8000.0  0      0.1       8.0      3.00      2                1000.0   
                         7000.0  0      0.1       8.0      3.00      2                1000.0   
                         6000.0  0      0.1       8.0      3.00      2                1000.0   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0                  -1.0   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2                1000.0   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0                  -1.0   
                         1000.0  0      0.0       1000.0  -1.00      0                  -1.0   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0                 100.0   
                                                           1.00      0                 100.0   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2                1000.0   
                100.0    1000.0  0      0.1       16.0     1.00      10                100.0   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0                 100.0   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0                  -1.0   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2                1000.0   

                                                                                                                             predNew  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0             {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2             {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
                1000.0   18077.0 0      0.1       8.0      3.00      2                                                           NaN   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2                                                           NaN   
                                                           2.00      1                                                           NaN   
                                        0.0       8.0      3.00      0                                                           NaN   
                                                                     2                                                           NaN   
                                                                     1                                                           NaN   
                                                                     10                                                          NaN   
                                        0.1       8.0      3.00      0                                                           NaN   
                                                  4.0      1.00      1                                                           NaN   
                                                  8.0      2.00      2                                                           NaN   
                                                                     4                                                           NaN   
                                                  16.0     4.00      10                                                          NaN   
                                        0.0       8.0      7.00      10                                                          NaN   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10                                                          NaN   
                                                                     1                                                           NaN   
                                                  8.0      5.00      10                                                          NaN   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10                                                          NaN   
                                                  16.0     4.00      10                                                          NaN   
                                        0.0       8.0      1.00      0                                                           NaN   
                                                                     1                                                           NaN   
                                                                     2                                                           NaN   
                                                                     10                                                          NaN   
                                        0.1       8.0      1.00      0                                                           NaN   
                                        0.0       32.0     1.00      10                                                          NaN   
...                                                                                                                              ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2                                                           NaN   
                                 128    0.1       8.0      3.00      2                                                           NaN   
                                 16     0.1       8.0      4.00      2                                                           NaN   
                4520.0   18077.0 128    0.1       4.0      3.00      2                                                           NaN   
                2260.0   18077.0 64     0.1       8.0      0.50      2                                                           NaN   
                                 128    0.1       16.0     3.00      2                                                           NaN   
                                 256    0.1       16.0     3.00      2                                                           NaN   
                                 512    0.1       16.0     3.00      2                                                           NaN   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2                                                           NaN   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0                                                           NaN   
                                                           0.10      0                                                           NaN   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10                                                          NaN   
                1000.0   9000.0  0      0.1       8.0      3.00      2                                                           NaN   
                         8000.0  0      0.1       8.0      3.00      2                                                           NaN   
                         7000.0  0      0.1       8.0      3.00      2                                                           NaN   
                         6000.0  0      0.1       8.0      3.00      2                                                           NaN   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2                                                           NaN   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
                         1000.0  0      0.0       1000.0  -1.00      0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0                                                           NaN   
                                                           1.00      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2                                                           NaN   
                100.0    1000.0  0      0.1       16.0     1.00      10                                                          NaN   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0                                                           NaN   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2                                                           NaN   

                                                                                  rotateMaxAgl  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0                       0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0                       0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2                       2   
                1000.0   18077.0 0      0.1       8.0      3.00      2                       2   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0                       0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2                       2   
                                                           2.00      1                       1   
                                        0.0       8.0      3.00      0                       0   
                                                                     2                       2   
                                                                     1                       1   
                                                                     10                     10   
                                        0.1       8.0      3.00      0                       0   
                                                  4.0      1.00      1                       1   
                                                  8.0      2.00      2                       2   
                                                                     4                       4   
                                                  16.0     4.00      10                     10   
                                        0.0       8.0      7.00      10                     10   
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0                       0   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10                     10   
                                                                     1                       1   
                                                  8.0      5.00      10                     10   
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2                       2   
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10                     10   
                                                  16.0     4.00      10                     10   
                                        0.0       8.0      1.00      0                       0   
                                                                     1                       1   
                                                                     2                       2   
                                                                     10                     10   
                                        0.1       8.0      1.00      0                       0   
                                        0.0       32.0     1.00      10                     10   
...                                                                                        ...   
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2                       2   
                                 128    0.1       8.0      3.00      2                       2   
                                 16     0.1       8.0      4.00      2                       2   
                4520.0   18077.0 128    0.1       4.0      3.00      2                       2   
                2260.0   18077.0 64     0.1       8.0      0.50      2                       2   
                                 128    0.1       16.0     3.00      2                       2   
                                 256    0.1       16.0     3.00      2                       2   
                                 512    0.1       16.0     3.00      2                       2   
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0                       0   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0                       0   
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2                       2   
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0                       0   
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0                       0   
                                                           0.10      0                       0   
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10                     10   
                1000.0   9000.0  0      0.1       8.0      3.00      2                       2   
                         8000.0  0      0.1       8.0      3.00      2                       2   
                         7000.0  0      0.1       8.0      3.00      2                       2   
                         6000.0  0      0.1       8.0      3.00      2                       2   
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0                       0   
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2                       2   
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0                       0   
                         1000.0  0      0.0       1000.0  -1.00      0                       0   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0                       0   
                                                           1.00      0                       0   
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2                       2   
                100.0    1000.0  0      0.1       16.0     1.00      10                     10   
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0                       0   
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0                       0   
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2                       2   

                                                                                  rotatePby  
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.00      0                    0  
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.00     0                    0  
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.00      2                  0.1  
                1000.0   18077.0 0      0.1       8.0      3.00      2                  0.1  
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.00     0                    0  
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.1       8.0      1.00      2                  0.1  
                                                           2.00      1                  0.1  
                                        0.0       8.0      3.00      0                    0  
                                                                     2                    0  
                                                                     1                    0  
                                                                     10                   0  
                                        0.1       8.0      3.00      0                  0.1  
                                                  4.0      1.00      1                  0.1  
                                                  8.0      2.00      2                  0.1  
                                                                     4                  0.1  
                                                  16.0     4.00      10                 0.1  
                                        0.0       8.0      7.00      10                   0  
LgtRgr.skl     -1.0      18077.0 0      0.0       18077.0 -1.00      0                    0  
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.0       4.0      4.00      10                   0  
                                                                     1                    0  
                                                  8.0      5.00      10                   0  
MLP.SGD.tfw     2260.0   18077.0 512    0.1       8.0      0.01      2                  0.1  
LgtRgr.SGD.tfw  1000.0   18077.0 0      0.5       8.0      4.00      10                 0.5  
                                                  16.0     4.00      10                 0.5  
                                        0.0       8.0      1.00      0                    0  
                                                                     1                    0  
                                                                     2                    0  
                                                                     10                   0  
                                        0.1       8.0      1.00      0                  0.1  
                                        0.0       32.0     1.00      10                   0  
...                                                                                     ...  
MLP.SGD.tfw     2260.0   18077.0 1024   0.1       8.0      3.00      2                  0.1  
                                 128    0.1       8.0      3.00      2                  0.1  
                                 16     0.1       8.0      4.00      2                  0.1  
                4520.0   18077.0 128    0.1       4.0      3.00      2                  0.1  
                2260.0   18077.0 64     0.1       8.0      0.50      2                  0.1  
                                 128    0.1       16.0     3.00      2                  0.1  
                                 256    0.1       16.0     3.00      2                  0.1  
                                 512    0.1       16.0     3.00      2                  0.1  
LgtRgr.skl     -1.0      15000.0 0      0.0       15000.0 -1.00      0                    0  
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  10.00     0                    0  
LgtRgr.SGD.tfw  1000.0   10000.0 0      0.1       8.0      3.00      2                  0.1  
LgtRgr.skl     -1.0      10000.0 0      0.0       10000.0 -1.00      0                    0  
LgtRgr.tfw      1000.0   10000.0 0      0.0       10000.0  1.00      0                    0  
                                                           0.10      0                    0  
LgtRgr.SGD.tfw  100.0    10000.0 0      0.1       16.0     1.00      10                 0.1  
                1000.0   9000.0  0      0.1       8.0      3.00      2                  0.1  
                         8000.0  0      0.1       8.0      3.00      2                  0.1  
                         7000.0  0      0.1       8.0      3.00      2                  0.1  
                         6000.0  0      0.1       8.0      3.00      2                  0.1  
LgtRgr.skl     -1.0      5000.0  0      0.0       5000.0  -1.00      0                    0  
LgtRgr.SGD.tfw  1000.0   5000.0  0      0.1       8.0      3.00      2                  0.1  
LgtRgr.skl     -1.0      2000.0  0      0.0       2000.0  -1.00      0                    0  
                         1000.0  0      0.0       1000.0  -1.00      0                    0  
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   10.00     0                    0  
                                                           1.00      0                    0  
LgtRgr.SGD.tfw  1000.0   1000.0  0      0.1       8.0      3.00      2                  0.1  
                100.0    1000.0  0      0.1       16.0     1.00      10                 0.1  
LgtRgr.tfw      100.0    1000.0  0      0.0       1000.0   0.10      0                    0  
LgtRgr.skl     -1.0      100.0   0      0.0       100.0   -1.00      0                    0  
LgtRgr.SGD.tfw  1000.0   100.0   0      0.1       8.0      3.00      2                  0.1  

[234 rows x 15 columns]
In [18]:
%run img_utils.py
srchParamsDct = {
    'nObsFit' : [1000, 5000, 10000, glbObsFitFtr.shape[0]],
#     'nObsFit' : [1000, 5000, 6000, 7000, 8000, 9000, 10000, 
#                     glbObsFitFtr.shape[0], glbObsTrnFtr.shape[0]]
    'nObsBtc' : [8],    
#     'nObsBtc' : [4, 8, 16, 32],        
    'rotatePby' : [0.1],
#     'rotatePby' : [0.0, 0.1, 0.2, 0.5],    
    'rotateMaxAgl' : [2],
#     'rotateMaxAgl' : [0, 1, 10],    
    'nRELUs' : [512],
#     'nRELUs' : [16, 32, 64, 128, 256, 512, 1024],    
    'nStepsTfw' : [2260],
#     'nStepsTfw' : [100, 1000, 
#                    1130 (min. for nObsBtc = 16),     
#                    2260 (min. for nObsBtc = 8), 
#                    4520 (min. for nObsBtc = 4),     
#                    10000],    
    'lrnRateTfw' : [0.01]
#     'lrnRateTfw' : [0.001, 0.01, 0.1, 0.5, 1.0, 5.0, 7.0, 10.0]    
                }

jnk = mysearchParams(fitMdlMLPRELUSGDTfw, srchParamsDct = srchParamsDct,
                     curResultsDf = glbMdlDf, 
               mode = 'displayonly', 
        sort_values    = ['nObsFit', 'accVld', 'logLossVld', 'duration'],
        sort_ascending = [False    , True    , False,        False],
                save_drop_cols = 'model',     
                save_filepathname = glbPickleFile['models'],
              lclXFit = glbXFit, lclYFit = glbYFit) 

# thsDf, thsObsVldRspPredProba, thsObsNewRspPredProba = fitMdlLgtRgrTfw(
#     glbXFit, glbYFit, 
#     nObsFit = 100, nStepsTfw = 10, lrnRateTfw = 0.5,
#     visualize = False, newObs = False, verbose = False)
mysearchParams: will run <function fitMdlMLPRELUSGDTfw at 0x112ace0c8> with params:
nStepsTfw  nObsFit nRELUs rotatePby  nObsBtc  lrnRateTfw rotateMaxAgl
                                                                     
   2260.0   1000.0    512       0.1      8.0        0.01            2
   2260.0   5000.0    512       0.1      8.0        0.01            2
   2260.0  10000.0    512       0.1      8.0        0.01            2
mysearchParams: total runs: 3
In [19]:
%run img_utils.py

glbMdlDf = mysearchParams(fitMdlMLPRELUSGDTfw, srchParamsDct = srchParamsDct,
                     curResultsDf = glbMdlDf, 
               mode = 'run', 
        sort_values    = ['nObsFit', 'accVld', 'logLossVld', 'duration'],
        sort_ascending = [False    , False    , True,        True],       
                save_filepathname = glbPickleFile['models'],
                save_drop_cols = 'model',          
              lclXFit = glbXFit, lclYFit = glbYFit)
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:143: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:162: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:145: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
mysearchParams: running <function fitMdlMLPRELUSGDTfw at 0x112ace0c8> with params:
nStepsTfw       2260
nObsFit         1000
nRELUs           512
rotatePby        0.1
nObsBtc            8
lrnRateTfw      0.01
rotateMaxAgl       2

Logistic Regression (TensorFlow): nObsFit: 1000; nObsBtc:    8; rotatePby: 0.1000; rotateMaxAgl:   2; nRELUs:   512; nStepsTfw: 2260; lrnRateTfw:0.0100 
  visualize: False; newObs: False; verbose: False
  duration: 54 seconds
mysearchParams: running <function fitMdlMLPRELUSGDTfw at 0x112ace0c8> with params:
nStepsTfw       2260
nObsFit         5000
nRELUs           512
rotatePby        0.1
nObsBtc            8
lrnRateTfw      0.01
rotateMaxAgl       2

Logistic Regression (TensorFlow): nObsFit: 5000; nObsBtc:    8; rotatePby: 0.1000; rotateMaxAgl:   2; nRELUs:   512; nStepsTfw: 2260; lrnRateTfw:0.0100 
  visualize: False; newObs: False; verbose: False
  duration: 54 seconds
mysearchParams: running <function fitMdlMLPRELUSGDTfw at 0x112ace0c8> with params:
nStepsTfw        2260
nObsFit         10000
nRELUs            512
rotatePby         0.1
nObsBtc             8
lrnRateTfw       0.01
rotateMaxAgl        2

Logistic Regression (TensorFlow): nObsFit:10000; nObsBtc:    8; rotatePby: 0.1000; rotateMaxAgl:   2; nRELUs:   512; nStepsTfw: 2260; lrnRateTfw:0.0100 
  visualize: False; newObs: False; verbose: False
  duration: 55 seconds
mysearchParams: total rows:   239 exceeds 10; suppressing printing
Compressed pickle file: data/img_M_SFDD_ImgSz_64.pickle; size: 81 KB
In [20]:
glbMdlDf['bestFit'] = False
glbMdlDf.ix[(
 'LgtRgr.SGD.tfw', 1000.0,    18077.0, 0,      0.1,       8.0,     3.0,        2), 
# LgtRgr.SGD.tfw   1000.0     18077.0  0,      0.1        8.0      3.0         2            
# id               nStepsTfw  nObsFit  nRELUs, rotatePby  nObsBtc  lrnRateTfw  rotateMaxAgl
            'bestFit'] = True            
print glbMdlDf[glbMdlDf['bestFit']]
print glbMdlDf[['accVld', 'bestFit', 'id']].head().to_string(index = False)
# print glbMdlDf[glbMdlDf.nObsFit >= 10000][
#     list(set(glbMdlDf.columns) - set(srchParamsDct.keys()))]
                                                                                     accVld  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2             0.381643   

                                                                                                                           accVldCls  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2             {u'accCls': [0.607438016529, 0.219665271967, 0...   

                                                                                  bestFit  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2               True   

                                                                                   duration  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2                   11   

                                                                                               id  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                   
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2             LgtRgr.SGD.tfw   

                                                                                   logLossVld  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2              20.546733   

                                                                                                                       logLossVldCls  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2             {u'logLossCls': [1.48863261945, 2.76463156066,...   

                                                                                   lrnRateTfw  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2                    3.0   

                                                                                  model  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl         
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2              NaN   

                                                                                   nObsBtc  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2                 8.0   

                                                                                   nObsFit  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2             18077.0   

                                                                                  nRELUs  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl          
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2                 0   

                                                                                   nStepsTfw  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl              
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2                1000.0   

                                                                                  predNew  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2                NaN   

                                                                                  rotateMaxAgl  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2                       2   

                                                                                  rotatePby  
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.SGD.tfw 1000.0    18077.0 0      0.1       8.0     3.0        2                  0.1  
accVld bestFit              id
                                
1.000000   False      LgtRgr.skl
0.987348   False      LgtRgr.tfw
0.833218   False  LgtRgr.SGD.tfw
0.381643    True  LgtRgr.SGD.tfw
0.375201   False      LgtRgr.tfw
In [21]:
mask = glbMdlDf['bestFit'].values | \
       glbMdlDf['id'].str.contains('MLP.SGD.tfw', na = False).values
print glbMdlDf[mask]['accVld']
id              nStepsTfw  nObsFit  nRELUs  rotatePby  nObsBtc  lrnRateTfw  rotateMaxAgl
LgtRgr.SGD.tfw  1000.0     18077.0  0       0.1        8.0      3.000       2               0.381643
MLP.SGD.tfw     2260.0     18077.0  512     0.1        8.0      0.010       2               0.335864
                10000.0    18077.0  512     0.1        8.0      0.010       2               0.333793
                2260.0     18077.0  512     0.1        16.0     0.010       1               0.326202
                                                                0.009       1               0.315160
                                            0.2        16.0     0.010       1               0.311939
                                            0.1        16.0     0.009       2               0.311939
                5000.0     18077.0  512     0.1        8.0      0.010       2               0.311249
                2260.0     18077.0  512     0.2        16.0     0.009       3               0.311019
                                            0.1        16.0     0.010       2               0.308719
                                            0.5        8.0      0.010       2               0.307338
                                            0.1        8.0      0.005       2               0.306418
                                                                0.010       1               0.305958
                                                                            3               0.305958
                                            0.2        16.0     0.020       3               0.305038
                                            0.1        8.0      0.010       10              0.302738
                                                                0.007       2               0.300897
                1130.0     18077.0  512     0.1        16.0     0.010       2               0.299287
                2260.0     18077.0  256     0.2        16.0     0.010       2               0.298827
                                                                0.009       3               0.297677
                                    512     0.2        16.0     0.009       2               0.297677
                                                                0.020       1               0.297447
                                            0.1        8.0      0.009       2               0.296066
                                            0.2        16.0     0.010       2               0.295836
                                            0.1        16.0     0.010       3               0.295606
                                            0.3        8.0      0.010       2               0.293536
                                            0.1        16.0     0.009       3               0.293536
                                                       8.0      0.020       2               0.292846
                                    256     0.2        16.0     0.010       3               0.291695
                                    512     0.2        16.0     0.009       1               0.291695
                                                                                              ...   
                                    32      0.1        8.0      0.100       2               0.102139
                                                                0.500       2               0.102139
                                                                1.000       2               0.102139
                                    128     0.1        8.0      1.000       2               0.102139
                                    32      0.1        8.0      2.000       2               0.102139
                                                                3.000       2               0.102139
                                    256     0.1        8.0      3.000       2               0.102139
                                    32      0.1        8.0      4.000       2               0.102139
                4520.0     18077.0  256     0.1        4.0      3.000       2               0.102139
                                    512     0.1        4.0      3.000       2               0.102139
                2260.0     18077.0  16      0.1        8.0      0.100       2               0.101909
                                                                0.500       2               0.101909
                                    64      0.1        8.0      1.000       2               0.101909
                                    16      0.1        8.0      1.000       2               0.101909
                                                                2.000       2               0.101909
                                    64      0.1        8.0      2.000       2               0.101909
                                    512     0.1        8.0      3.000       2               0.101909
                                    16      0.1        8.0      3.000       2               0.101909
                                    64      0.1        8.0      3.000       2               0.101909
                                    1024    0.1        8.0      3.000       2               0.101909
                                    128     0.1        8.0      3.000       2               0.101909
                                    16      0.1        8.0      4.000       2               0.101909
                4520.0     18077.0  128     0.1        4.0      3.000       2               0.101909
                2260.0     18077.0  64      0.1        8.0      0.500       2               0.101449
                                    128     0.1        16.0     3.000       2               0.096848
                                    256     0.1        16.0     3.000       2               0.096848
                                    512     0.1        16.0     3.000       2               0.096848
                           10000.0  512     0.1        8.0      0.010       2               0.324132
                           5000.0   512     0.1        8.0      0.010       2               0.279273
                           1000.0   512     0.1        8.0      0.010       2               0.281343
Name: accVld, dtype: float64
In [23]:
# Set value based on condition

# print glbMdlDf.ix[glbMdlDf['id'].str.contains('LogisticRegression.SGD.tf', 
#                                               na=False), 'id']
# glbMdlDf.ix[glbMdlDf['id'].str.contains('LogisticRegression.SGD.tf', 
#                                               na=False), 'id'] = 'LgtRgr.SGD.tf'
# print glbMdlDf.ix[glbMdlDf['id'].str.contains('LogisticRegression.SGD.tf', 
#                                               na=False), 'id']

def lclfixNanDf(df, column, default):
    print "\n Before:"
    dspDf = df[[column]]
    dspDf[column + '.isnull'] = df[column].isnull()
    print dspDf.to_string(index = False)
    
    df.loc[df[column].isnull(), column] = default
    
    print "\n After:"
    dspDf = df[[column]]
    dspDf[column + '.isnull'] = df[column].isnull()
    print dspDf.to_string(index = False)    
    return(df)

# tmpMdlDf = lclfixNanDf(glbMdlDf, column = 'nRELUs', default = 0)

# print glbMdlDf.ix[- glbMdlDf['nStepsTfw'].isnull(), ['id', 'nStepsTfw']]
# glbMdlDf.ix[- glbMdlDf['nStepsTfw'].isnull(), 'id'] = 'LogisticRegression.tf'
# print glbMdlDf.ix[- glbMdlDf['nStepsTfw'].isnull(), ['id', 'nStepsTfw']]

# print glbMdlDf.ix[glbMdlDf['nObsBtc'].isnull(), ['nObsBtc', 'nObsFit']]
# # glbMdlDf.ix[glbMdlDf['nObsBtc'].isnull(), 'nObsBtc'] = \
# #     glbMdlDf.ix[glbMdlDf['nObsBtc'].isnull(), 'nObsFit']
# glbMdlDf['nObsBtc'] = glbMdlDf.apply(
#     lambda (row): row['nObsFit'] if pd.isnull(row['nObsBtc']) else row['nObsBtc'],
#                         axis = 1)
# print 'After:'    
# print glbMdlDf.ix[glbMdlDf['nObsBtc'].isnull(), ['nObsBtc', 'nObsFit']]

# Change value
# tmpMdlDf = glbMdlDf
# print tmpMdlDf[(tmpMdlDf['id'].str.contains('LgtRgr.skl', na = False)) & 
#                (tmpMdlDf['nStepsTfw'] == 1.0)]
# print tmpMdlDf.ix[(tmpMdlDf['id'].str.contains('LgtRgr.skl', na = False)) & 
#                   (tmpMdlDf['nStepsTfw'] == 1.0), 'nStepsTfw']
# tmpMdlDf.ix[(tmpMdlDf['id'].str.contains('LgtRgr.skl', na = False)) & 
#                   (tmpMdlDf['nStepsTfw'] == 1.0), 'nStepsTfw'] = -1.0
# print 'After:'
# print tmpMdlDf

# Remove specific models
# mask = (glbMdlDf['id'].str.contains('MLP.SGD.tfw', na = False))
# mask = (glbMdlDf['id'].str.contains('LgtRgr.tfw', na = False)) & \
#        (glbMdlDf['nObsFit'] == 10000.0)
# print mask
# tmpMdlDf = glbMdlDf[~mask]
# print tmpMdlDf.to_string(index = False)

# Remove dups
print glbMdlDf.columns
# print (glbMdlDf['logLossVld'])
print (glbMdlDf.index.duplicated())
tmpMdlDf = glbMdlDf[~glbMdlDf.index.duplicated()]
print (tmpMdlDf.index.duplicated())

# glbMdlDf['nObsBtc'] = glbMdlDf['nObsFit'] 

# glbMdlDf = tmpMdlDf
# print 'After:'
# print glbMdlDf.to_string(index = False)
# print glbMdlDf['bestFit']
Index([u'accVld', u'accVldCls', u'bestFit', u'duration', u'id', u'logLossVld',
       u'logLossVldCls', u'lrnRateTfw', u'model', u'nObsBtc', u'nObsFit',
       u'nRELUs', u'nStepsTfw', u'predNew', u'rotateMaxAgl', u'rotatePby'],
      dtype='object')
[False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False]
[False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False]
In [57]:
glbMdlDf = glbMdlDf.set_index(['id'] + srchParamsDct.keys(), drop = False)
glbMdlDf = glbMdlDf.sort_values(['nObsFit', 'accVld', 'logLossVld', 'duration'], 
                     ascending = [False    , False    , True,        True])
print glbMdlDf.head()
                                                                                     accVld  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0             1.000000   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0             0.987348   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2             0.833218   
                1000.0   18077.0 0      0.1       8.0      3.0       2             0.381643   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0             0.375201   

                                                                                                                           accVldCls  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0             {u'accCls': [0.989669421488, 0.991631799163, 0...   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2             {u'accCls': [0.704545454545, 0.910041841004, 0...   
                1000.0   18077.0 0      0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0             {u'accCls': [0.504132231405, 0.435146443515, 0...   

                                                                                  bestFit  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0              False   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0              False   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2              False   
                1000.0   18077.0 0      0.1       8.0      3.0       2               True   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0              False   

                                                                                   duration  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0                  874   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0                  743   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2                  122   
                1000.0   18077.0 0      0.1       8.0      3.0       2                   11   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0                  519   

                                                                                               id  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                   
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0                 LgtRgr.skl   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0                 LgtRgr.tfw   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2             LgtRgr.SGD.tfw   
                1000.0   18077.0 0      0.1       8.0      3.0       2             LgtRgr.SGD.tfw   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0                 LgtRgr.tfw   

                                                                                   logLossVld  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0               0.018463   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0               0.193149   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2               4.836929   
                1000.0   18077.0 0      0.1       8.0      3.0       2              20.546733   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0              19.209913   

                                                                                                                       logLossVldCls  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0                                                           NaN   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0             {u'logLossCls': [0.0123335882818, 0.0241534716...   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2             {u'logLossCls': [0.973879753517, 0.22334474905...   
                1000.0   18077.0 0      0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0             {u'logLossCls': [1.72596805748, 1.7853875361, ...   

                                                                                   lrnRateTfw  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0                   -1.0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0                   10.0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2                    3.0   
                1000.0   18077.0 0      0.1       8.0      3.0       2                    3.0   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0                   10.0   

                                                                                  model  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl         
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0              NaN   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0              NaN   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2              NaN   
                1000.0   18077.0 0      0.1       8.0      3.0       2              NaN   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0              NaN   

                                                                                   nObsBtc  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0             22424.0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0             22424.0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2                 8.0   
                1000.0   18077.0 0      0.1       8.0      3.0       2                 8.0   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0             18077.0   

                                                                                   nObsFit  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0             22424.0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0             22424.0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2             22424.0   
                1000.0   18077.0 0      0.1       8.0      3.0       2             18077.0   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0             18077.0   

                                                                                  nRELUs  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl          
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0                 0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0                 0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2                 0   
                1000.0   18077.0 0      0.1       8.0      3.0       2                 0   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0                 0   

                                                                                   nStepsTfw  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl              
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0                  -1.0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0                1000.0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2                2804.0   
                1000.0   18077.0 0      0.1       8.0      3.0       2                1000.0   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0                1000.0   

                                                                                                                             predNew  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0             {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2             {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
                1000.0   18077.0 0      0.1       8.0      3.0       2                                                           NaN   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0                                                           NaN   

                                                                                  rotateMaxAgl  \
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0                       0   
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0                       0   
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2                       2   
                1000.0   18077.0 0      0.1       8.0      3.0       2                       2   
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0                       0   

                                                                                  rotatePby  
id             nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
LgtRgr.skl     -1.0      22424.0 0      0.0       22424.0 -1.0       0                    0  
LgtRgr.tfw      1000.0   22424.0 0      0.0       22424.0  10.0      0                    0  
LgtRgr.SGD.tfw  2804.0   22424.0 0      0.1       8.0      3.0       2                  0.1  
                1000.0   18077.0 0      0.1       8.0      3.0       2                  0.1  
LgtRgr.tfw      1000.0   18077.0 0      0.0       18077.0  10.0      0                    0  
In [59]:
myexportDf(glbMdlDf, 
           save_filepathname = glbPickleFile['models'],
           save_drop_cols = 'model'
          )
Compressed pickle file: data/img_M_SFDD_ImgSz_64.pickle; size: 42 KB
In [25]:
robjects.pandas2ri.activate()
pltRDf = robjects.conversion.py2ri(glbMdlDf)
# print(pltRDf)
# pltRFn = robjects.r("""
#     source('~/Dropbox/datascience/R/myplot.R')
#     function(RDf, filename) {
#         mypltModelStats(RDf, c('accVld', 'logLossVld', 'duration'), 
#             dim = c('nObsFit', 'id', 
#                     'nRELUs', 
#                     'nObsBtc', 'rotatePby', 'rotateMaxAgl',
#                     'nStepsTfw', 'lrnRateTfw'), 
#                 scaleXFn = NULL, 
#                 #highLightIx = which.min(RDf$logLossVld),
#                 highLightIx = which(RDf$bestFit == 'TRUE'),                
#             title = NULL, 
#             fileName = filename)
#     }                        
# """)    
# pltRFn(pltRDf, 'img_05_fit_MLP_RELU_SGD_Tfw_SFDD_glbMdlDf.png')

# pltRFn = robjects.r("""
#     source('~/Dropbox/datascience/R/myplot.R')
#     function(RDf, filename) {
#         mypltModelStats(RDf, c('accVld', 'logLossVld'), 
#             dim = c('nObsFit', 'id', 
#                     'nRELUs',
#                     'nObsBtc', 'rotatePby', 'rotateMaxAgl',
#                     'nStepsTfw', 'lrnRateTfw'), 
#                 scaleXFn = NULL, 
#                 #highLightIx = which.min(RDf$logLossVld),
#                 highLightIx = which(RDf$bestFit == 'TRUE'),                
#             title = NULL, 
#             fileName = filename)
#     }                        
# """)    
# pltRFn(pltRDf, 'img_05_fit_MLP_RELU_SGD_Tfw_SFDD_glbMdlDf_logLossVld.png')

# pltRFn = robjects.r("""
#     source('~/Dropbox/datascience/R/myplot.R')
#     function(RDf, filename) {
#         mypltModelStats(RDf, c('accVld'), 
#             dim = c('nObsFit', 'id', 
#                     'nRELUs',
#                     'nObsBtc', 'rotatePby', 'rotateMaxAgl',
#                     'nStepsTfw', 'lrnRateTfw'), 
#                 scaleXFn = NULL, 
#                 #highLightIx = which.min(RDf$logLossVld),
#                 highLightIx = which(RDf$bestFit == 'TRUE'),                
#             title = NULL, 
#             fileName = filename)
#     }                        
# """)    
# pltRFn(pltRDf, 'img_05_fit_MLP_RELU_SGD_Tfw_SFDD_glbMdlDf_accVld.png')

pltRFn = robjects.r("""
    source('~/Dropbox/datascience/R/myplot.R')
    function(RDf, filename) {
    pltRDf = rbind(NULL
                      , subset(RDf, id %in% c("LgtRgr.skl") &
                                   TRUE)
                      , subset(RDf, id %in% c("LgtRgr.tfw") &
                                   nStepsTfw %in% c(1000) &
                                   lrnRateTfw %in% c(10.0) &
                                   TRUE)
                      , subset(RDf, id %in% c("LgtRgr.SGD.tfw") &
                                   nStepsTfw %in% c(1000, 2804) &
                                   rotateMaxAgl %in% c(2) &
                                   lrnRateTfw %in% c(3) &
                                   nObsBtc %in% c(8) &
                                   rotatePby %in% c(0.1) &
                                   TRUE)
                      , subset(RDf, id %in% c("MLP.SGD.tfw") &
                                   rotateMaxAgl %in% c(2) &
                                   lrnRateTfw %in% c(0.01) &
                                   nObsBtc %in% c(8) &
                                   rotatePby %in% c(0.1) &
                                   nRELUs %in% c(512) &
                                   nStepsTfw %in% c(2260) &
                                   TRUE)
    )    
        mypltModelStats(pltRDf,
                measure = c('accVld'),
                dim = c('nObsFit', 'id',
                        'nRELUs',
                        'nStepsTfw',                        
                        # 'nObsBtc',
                        # 'lrnRateTfw',
                        # 'rotatePby',
                        # 'rotateMaxAgl',
                        NULL),        
                scaleXFn = NULL, 
                highLightIx = which(pltRDf$bestFit == 'TRUE'),                
            title = NULL, 
            fileName = filename)
    }                        
""")    
pltRFn(pltRDf, 'img_05_fit_MLP_RELU_SGD_Tfw_SFDD_glbMdlDf_accVldSel.png')

# id nStepsTfw  nObsFit  rotatePby  nObsBtc  lrnRateTfw  rotateMaxAgl
Out[25]:
<ListVector - Python:0x146ae5a28 / R:0x7faa61b40b50>
[DataF..., ListV..., Envir..., ..., ListV..., Envir..., ListV...]
<ListVector - Python:0x146ae5a28 / R:0x7faa61b40b50>
[DataF..., ListV..., Envir..., ..., ListV..., Envir..., ListV...]
<ListVector - Python:0x146ae5a28 / R:0x7faa61b40b50>
[DataF..., ListV..., Envir..., ..., ListV..., Envir..., ListV...]
  scales: <class 'rpy2.robjects.environments.Environment'>
  <Environment - Python:0x146ae5e18 / R:0x7faa7b40b0b0>
  ...
<ListVector - Python:0x146ae5a28 / R:0x7faa61b40b50>
[DataF..., ListV..., Envir..., ..., ListV..., Envir..., ListV...]
  layers: <class 'rpy2.robjects.environments.Environment'>
  <Environment - Python:0x146ae3128 / R:0x7faa6f502fc0>
<ListVector - Python:0x146ae5a28 / R:0x7faa61b40b50>
[DataF..., ListV..., Envir..., ..., ListV..., Envir..., ListV...]
In [24]:
glbMdlDf.to_csv('img_05_fit_MLP_RELU_SGD_Tfw_SFDD_glbMdlDf.csv')

Fit selected model to glbObsFit

In [29]:
# selMdlSrs = glbMdlDf[glbMdlDf['bestFit']]

mask = (glbMdlDf['id'].str.contains('MLP.SGD.tfw', na = False)) & \
       (glbMdlDf['accVld'] > 0.334)
selMdlSrs = glbMdlDf[mask]
print selMdlSrs
                                                                                  accVld  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2             0.335864   

                                                                                                                        accVldCls  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2             {u'accCls': [0.576446280992, 0.278242677824, 0...   

                                                                               bestFit  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2              False   

                                                                                duration  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2                   54   

                                                                                         id  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2             MLP.SGD.tfw   

                                                                                logLossVld  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2              19.782698   

                                                                                                                    logLossVldCls  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2             {u'logLossCls': [1.38497343758, 2.23958887677,...   

                                                                                lrnRateTfw  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2                   0.01   

                                                                               model  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl         
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2              NaN   

                                                                                nObsBtc  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2                 8.0   

                                                                                nObsFit  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2             18077.0   

                                                                               nRELUs  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl          
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2               512   

                                                                                nStepsTfw  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl              
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2                2260.0   

                                                                               predNew  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2                NaN   

                                                                               rotateMaxAgl  \
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl                
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2                       2   

                                                                               rotatePby  
id          nStepsTfw nObsFit nRELUs rotatePby nObsBtc lrnRateTfw rotateMaxAgl            
MLP.SGD.tfw 2260.0    18077.0 512    0.1       8.0     0.01       2                  0.1  
In [31]:
selMdlDf, selYVldPby, selYNewPby = fitMdlMLPRELUSGDTfw(
    glbXFit, glbYFit, 
    nObsFit = glbXFit.shape[0], 
    nObsBtc = selMdlSrs['nObsBtc'][0],     
    rotatePby = selMdlSrs['rotatePby'][0],     
    rotateMaxAgl = selMdlSrs['rotateMaxAgl'][0],
    nRELUs = selMdlSrs['nRELUs'][0],
    nStepsTfw = selMdlSrs['nStepsTfw'][0], 
    lrnRateTfw = selMdlSrs['lrnRateTfw'][0], 
    visualize = True, newObs = True, verbose = True)

# thsMdlDf, thsYVldPby, thsYNewPby = fitMdlMLPRELUSGDTfw(
#     glbXFit, glbYFit, 
#     nObsFit = 100, nObsBtc = 16, 
#     rotatePby = 0.2, rotateMaxAgl = 10, 
#     nRELUs = 128,
#     nStepsTfw = 10, lrnRateTfw = 0.5, 
#     visualize = True, newObs = False, verbose = False)
Logistic Regression (TensorFlow): nObsFit:18077; nObsBtc:    8; rotatePby: 0.1000; rotateMaxAgl:   2; nRELUs:   512; nStepsTfw: 2260; lrnRateTfw:0.0100 
  visualize: True; newObs: True; verbose: True
('  tfwW1:', <tf.Tensor 'Identity:0' shape=(4096, 512) dtype=float32>)
('  tfwB1:', <tf.Tensor 'Identity_1:0' shape=(512,) dtype=float32>)
('  tfwW3:', <tf.Tensor 'Identity_2:0' shape=(512, 10) dtype=float32>)
('  tfwB3:', <tf.Tensor 'Identity_3:0' shape=(10,) dtype=float32>)
  Initialized
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:143: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:162: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:145: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  step     1(    1 secs): Minibatch rotation:angle: 0.7815
  step     6(    1 secs): Minibatch rotation:angle: 1.3900
  step    13(    1 secs): Minibatch rotation:angle: 1.4487
  step    34(    1 secs): Minibatch rotation:angle: 0.2647
  step    39(    1 secs): Minibatch rotation:angle: -0.4238
  step    40(    1 secs): Minibatch rotation:angle: -1.0228
  step    42(    2 secs): Minibatch rotation:angle: -1.5997
  step    73(    2 secs): Minibatch rotation:angle: -1.4536
  step    75(    2 secs): Minibatch rotation:angle: 0.7455
  step    78(    2 secs): Minibatch rotation:angle: -0.2561
  step    86(    2 secs): Minibatch rotation:angle: 0.0559
  step    89(    2 secs): Minibatch rotation:angle: 0.8329
  step    93(    2 secs): Minibatch rotation:angle: 0.1879
  step   101(    2 secs): Minibatch rotation:angle: 0.1547
  step   123(    2 secs): Minibatch rotation:angle: 0.4447
  step   134(    2 secs): Minibatch rotation:angle: -1.7246
  step   139(    2 secs): Minibatch rotation:angle: -0.6370
  step   148(    2 secs): Minibatch rotation:angle: -0.7290
  step   149(    2 secs): Minibatch rotation:angle: 0.6298
  step   168(    2 secs): Minibatch rotation:angle: 0.9559
  step   174(    2 secs): Minibatch rotation:angle: 1.4031
  step   177(    2 secs): Minibatch rotation:angle: 1.5177
  step   193(    2 secs): Minibatch rotation:angle: -1.5264
  step   208(    5 secs): Minibatch rotation:angle: 0.8651
  step   219(    5 secs): Minibatch rotation:angle: -0.7559
  step   227(    5 secs): Minibatch rotation:angle: -0.7687
  step   228(    5 secs): Minibatch rotation:angle: 0.7853
  step   229(    5 secs): Minibatch rotation:angle: 0.7060
  step   259(    5 secs): Minibatch rotation:angle: 1.1189
  step   262(    5 secs): Minibatch rotation:angle: 1.2409
  step   284(    5 secs): Minibatch rotation:angle: 1.2055
  step   302(    5 secs): Minibatch rotation:angle: -0.8014
  step   307(    5 secs): Minibatch rotation:angle: 1.5852
  step   320(    5 secs): Minibatch rotation:angle: -1.7845
  step   323(    5 secs): Minibatch rotation:angle: 0.6667
  step   355(    5 secs): Minibatch rotation:angle: -0.7972
  step   356(    5 secs): Minibatch rotation:angle: -1.0431
  step   380(    5 secs): Minibatch rotation:angle: 0.8782
  step   401(   10 secs): Minibatch rotation:angle: 1.0272
  step   406(   10 secs): Minibatch rotation:angle: 1.2680
  step   412(   10 secs): Minibatch rotation:angle: -0.3036
  step   427(   10 secs): Minibatch rotation:angle: 0.6773
  step   456(   10 secs): Minibatch rotation:angle: -0.2512
  step   457(   10 secs): Minibatch rotation:angle: 1.2892
  step   462(   10 secs): Minibatch rotation:angle: -1.4782
  step   520(   10 secs): Minibatch rotation:angle: 0.1854
  step   524(   10 secs): Minibatch rotation:angle: -0.2769
  step   544(   10 secs): Minibatch rotation:angle: -0.3829
  step   552(   10 secs): Minibatch rotation:angle: -0.8067
  step   555(   10 secs): Minibatch rotation:angle: -1.0371
  step   565(   10 secs): Minibatch rotation:angle: -0.0422
  step   581(   10 secs): Minibatch rotation:angle: -1.8645
  step   583(   10 secs): Minibatch rotation:angle: -0.3721
  step   587(   10 secs): Minibatch rotation:angle: -0.6783
  step   633(   15 secs): Minibatch rotation:angle: 0.2982
  step   644(   15 secs): Minibatch rotation:angle: -0.1618
  step   657(   15 secs): Minibatch rotation:angle: -0.7546
  step   658(   15 secs): Minibatch rotation:angle: 0.1138
  step   681(   15 secs): Minibatch rotation:angle: -1.7727
  step   682(   15 secs): Minibatch rotation:angle: 0.7245
  step   687(   15 secs): Minibatch rotation:angle: 1.4412
  step   689(   15 secs): Minibatch rotation:angle: -0.5182
  step   691(   15 secs): Minibatch rotation:angle: 0.6104
  step   700(   15 secs): Minibatch rotation:angle: 0.2777
  step   713(   15 secs): Minibatch rotation:angle: 0.4088
  step   731(   15 secs): Minibatch rotation:angle: 1.5995
  step   761(   15 secs): Minibatch rotation:angle: -0.1049
  step   764(   15 secs): Minibatch rotation:angle: -0.1286
  step   785(   15 secs): Minibatch rotation:angle: 0.2296
  step   795(   15 secs): Minibatch rotation:angle: -1.4570
  step   813(   20 secs): Minibatch rotation:angle: -1.5104
  step   837(   20 secs): Minibatch rotation:angle: 0.9490
  step   847(   20 secs): Minibatch rotation:angle: 1.2389
  step   857(   20 secs): Minibatch rotation:angle: 1.9708
  step   861(   20 secs): Minibatch rotation:angle: -1.3822
  step   877(   20 secs): Minibatch rotation:angle: -1.6069
  step   880(   20 secs): Minibatch rotation:angle: 1.4276
  step   882(   20 secs): Minibatch rotation:angle: 0.0323
  step   895(   20 secs): Minibatch rotation:angle: -0.7840
  step   909(   20 secs): Minibatch rotation:angle: 0.2200
  step   924(   20 secs): Minibatch rotation:angle: 0.9365
  step   939(   20 secs): Minibatch rotation:angle: 0.5616
  step   942(   20 secs): Minibatch rotation:angle: -1.3131
  step   945(   20 secs): Minibatch rotation:angle: 0.5496
  step   948(   20 secs): Minibatch rotation:angle: 1.8078
  step   952(   20 secs): Minibatch rotation:angle: 1.6791
  step   954(   20 secs): Minibatch rotation:angle: 1.3377
  step   969(   20 secs): Minibatch rotation:angle: 0.3555
  step   981(   20 secs): Minibatch rotation:angle: -0.8890
  step   992(   20 secs): Minibatch rotation:angle: -0.7087
  step  1003(   20 secs): Minibatch rotation:angle: -1.6007
  step  1020(   20 secs): Minibatch rotation:angle: -1.0628
  step  1032(   20 secs): Minibatch rotation:angle: -1.4750
  step  1048(   20 secs): Minibatch rotation:angle: 1.5043
  step  1057(   20 secs): Minibatch rotation:angle: 0.0029
  step  1061(   20 secs): Minibatch rotation:angle: 0.2589
  step  1067(   20 secs): Minibatch rotation:angle: -0.6912
  step  1075(   20 secs): Minibatch rotation:angle: -0.4388
  step  1078(   20 secs): Minibatch rotation:angle: -0.7461
  step  1110(   20 secs): Minibatch rotation:angle: -1.0476
  step  1130(   20 secs): Minibatch rotation:angle: 0.8604
  step  1139(   20 secs): Minibatch rotation:angle: 0.1264
  step  1141(   20 secs): Minibatch rotation:angle: -0.5500
  step  1146(   20 secs): Minibatch rotation:angle: 0.8126
  step  1151(   20 secs): Minibatch rotation:angle: -1.1652
  step  1153(   20 secs): Minibatch rotation:angle: 0.5463
  step  1180(   20 secs): Minibatch rotation:angle: 0.9390
  step  1182(   20 secs): Minibatch rotation:angle: -1.8405
  step  1189(   20 secs): Minibatch rotation:angle: -1.3134
  step  1197(   20 secs): Minibatch rotation:angle: -0.1215
  step  1204(   20 secs): Minibatch rotation:angle: -1.2543
  step  1208(   20 secs): Minibatch rotation:angle: 0.7490
  step  1229(   20 secs): Minibatch rotation:angle: 0.1293
  step  1237(   20 secs): Minibatch rotation:angle: 0.3663
  step  1266(   20 secs): Minibatch rotation:angle: -1.9999
  step  1278(   20 secs): Minibatch rotation:angle: 1.8027
  step  1295(   20 secs): Minibatch rotation:angle: 1.3164
  step  1297(   20 secs): Minibatch rotation:angle: 0.9677
  step  1299(   20 secs): Minibatch rotation:angle: 1.9622
  step  1325(   20 secs): Minibatch rotation:angle: -1.9778
  step  1328(   20 secs): Minibatch rotation:angle: -1.1786
  step  1334(   20 secs): Minibatch rotation:angle: -0.7078
  step  1336(   20 secs): Minibatch rotation:angle: -1.8895
  step  1359(   20 secs): Minibatch rotation:angle: -1.6903
  step  1382(   20 secs): Minibatch rotation:angle: 0.0515
  step  1385(   20 secs): Minibatch rotation:angle: 0.8232
  step  1387(   20 secs): Minibatch rotation:angle: 1.9280
  step  1404(   20 secs): Minibatch rotation:angle: -1.7674
  step  1415(   20 secs): Minibatch rotation:angle: -0.9821
  step  1418(   20 secs): Minibatch rotation:angle: 0.2995
  step  1434(   20 secs): Minibatch rotation:angle: 0.3138
  step  1447(   20 secs): Minibatch rotation:angle: -0.1445
  step  1468(   20 secs): Minibatch rotation:angle: 0.2396
  step  1472(   20 secs): Minibatch rotation:angle: -1.0896
  step  1480(   20 secs): Minibatch rotation:angle: 0.5134
  step  1484(   20 secs): Minibatch rotation:angle: 0.6300
  step  1512(   20 secs): Minibatch rotation:angle: 1.2379
  step  1520(   20 secs): Minibatch rotation:angle: 0.5878
  step  1532(   20 secs): Minibatch rotation:angle: 0.7924
  step  1544(   20 secs): Minibatch rotation:angle: -1.5924
  step  1546(   20 secs): Minibatch rotation:angle: 0.4798
  step  1551(   20 secs): Minibatch rotation:angle: 0.6005
  step  1569(   20 secs): Minibatch rotation:angle: -0.9395
  step  1594(   20 secs): Minibatch rotation:angle: 1.6593
  step  1600(   20 secs): Minibatch rotation:angle: 0.5128
  step  1647(   20 secs): Minibatch rotation:angle: 1.2361
  step  1663(   20 secs): Minibatch rotation:angle: -1.2202
  step  1693(   20 secs): Minibatch rotation:angle: -1.6133
  step  1695(   20 secs): Minibatch rotation:angle: -0.9869
  step  1701(   20 secs): Minibatch rotation:angle: -0.2891
  step  1709(   20 secs): Minibatch rotation:angle: 1.0592
  step  1715(   20 secs): Minibatch rotation:angle: -1.7232
  step  1716(   20 secs): Minibatch rotation:angle: 0.4602
  step  1721(   20 secs): Minibatch rotation:angle: 1.8439
  step  1723(   20 secs): Minibatch rotation:angle: 1.2296
  step  1743(   20 secs): Minibatch rotation:angle: 1.4123
  step  1746(   20 secs): Minibatch rotation:angle: 0.5527
  step  1747(   20 secs): Minibatch rotation:angle: -1.4935
  step  1768(   20 secs): Minibatch rotation:angle: -0.2607
  step  1772(   20 secs): Minibatch rotation:angle: 0.7055
  step  1781(   20 secs): Minibatch rotation:angle: 0.3354
  step  1817(   20 secs): Minibatch rotation:angle: -1.9580
  step  1821(   20 secs): Minibatch rotation:angle: -1.5412
  step  1825(   20 secs): Minibatch rotation:angle: -0.4509
  step  1827(   20 secs): Minibatch rotation:angle: 1.9688
  step  1851(   20 secs): Minibatch rotation:angle: -1.7624
  step  1857(   20 secs): Minibatch rotation:angle: 0.5838
  step  1862(   20 secs): Minibatch rotation:angle: -0.3668
  step  1874(   20 secs): Minibatch rotation:angle: -1.4491
  step  1875(   20 secs): Minibatch rotation:angle: -0.3541
  step  1888(   20 secs): Minibatch rotation:angle: 0.7662
  step  1894(   20 secs): Minibatch rotation:angle: 0.4572
  step  1905(   20 secs): Minibatch rotation:angle: -1.1159
  step  1906(   20 secs): Minibatch rotation:angle: -1.9946
  step  1915(   20 secs): Minibatch rotation:angle: 0.1886
  step  1923(   20 secs): Minibatch rotation:angle: 0.5597
  step  1938(   20 secs): Minibatch rotation:angle: -1.5014
  step  1940(   20 secs): Minibatch rotation:angle: -0.7812
  step  1941(   20 secs): Minibatch rotation:angle: -0.9926
  step  1977(   20 secs): Minibatch rotation:angle: 1.9638
  step  1978(   20 secs): Minibatch rotation:angle: -1.4872
  step  1991(   20 secs): Minibatch rotation:angle: 1.3604
  step  2008(   53 secs): Minibatch rotation:angle: -0.4081
  step  2014(   53 secs): Minibatch rotation:angle: -1.6980
  step  2027(   53 secs): Minibatch rotation:angle: -0.2367
  step  2030(   53 secs): Minibatch rotation:angle: -0.8204
  step  2041(   53 secs): Minibatch rotation:angle: -1.3729
  step  2046(   53 secs): Minibatch rotation:angle: -0.2749
  step  2081(   53 secs): Minibatch rotation:angle: -1.9513
  step  2084(   53 secs): Minibatch rotation:angle: -1.8022
  step  2098(   53 secs): Minibatch rotation:angle: 1.0991
  step  2100(   53 secs): Minibatch rotation:angle: -0.5681
  step  2101(   53 secs): Minibatch rotation:angle: -1.7471
  step  2111(   53 secs): Minibatch rotation:angle: -1.4369
  step  2132(   53 secs): Minibatch rotation:angle: -0.5205
  step  2148(   53 secs): Minibatch rotation:angle: 1.5780
  step  2153(   53 secs): Minibatch rotation:angle: 0.6324
  step  2158(   53 secs): Minibatch rotation:angle: 1.9805
  step  2159(   53 secs): Minibatch rotation:angle: 0.9734
  step  2164(   53 secs): Minibatch rotation:angle: 1.1774
  step  2172(   53 secs): Minibatch rotation:angle: 1.2144
  step  2185(   53 secs): Minibatch rotation:angle: -0.7179
  step  2203(   53 secs): Minibatch rotation:angle: -1.5074
  step  2205(   53 secs): Minibatch rotation:angle: 0.3687
  step  2233(   53 secs): Minibatch rotation:angle: -0.8576
  step  2243(   53 secs): Minibatch rotation:angle: -0.8914
  step  2249(   53 secs): Minibatch rotation:angle: 1.4322
  step  2250(   53 secs): Minibatch rotation:angle: 1.5765
  step  2258(   53 secs): Minibatch rotation:angle: -1.7482
  step  2259(   53 secs): Minibatch rotation:angle: 1.9248

  Vld accuracy:0.3359
[ 0.5764  0.2782  0.5686  0.1512  0.4444  0.1445  0.4898  0.3029  0.3407
  0.0265]
[[279  52   0  15  33   0  92   7   6   0]
 [ 24 133  69   6   5   8  73 129  28   3]
 [ 36  16 257   0   0   3  34  87  18   1]
 [149  71   2  67  90   2  21   9  32   0]
 [116   1  10  11 204   3  72  16  26   0]
 [117  10  59   0   5  61 153   8   8   1]
 [ 11 103  55   0  16   2 217  14  25   0]
 [  1  17  19   1   2   4 181 106  19   0]
 [ 17  12 103   5   9   1  63  26 124   4]
 [ 76  24 105  68  16  32  69  28  22  12]]
  Vld  logLoss:19.7827
[ 1.385   2.2396  1.113   2.6201  1.7168  2.6953  1.3689  1.7096  1.6075
  3.327 ]


max Pby for cls: c0; desc: normal driving; proba: 1.0000; nObs: 566
  img_62023.jpg:
  plot_occlusion:
  Proba:
[ 1.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c0; desc: normal driving; proba: 0.5036; nObs: 1
  img_37258.jpg:
  plot_occlusion:
  Proba:
[ 0.5036  0.      0.      0.0001  0.4964  0.      0.      0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c1; desc: texting - right; proba: 1.0000; nObs: 278
  img_89322.jpg:
  plot_occlusion:
  Proba:
[ 0.  1.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c1; desc: texting - right; proba: 0.5267; nObs: 1
  img_95570.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.5267  0.      0.      0.      0.      0.4733  0.      0.      0.    ]
  next best class: drinking


max Pby for cls: c2; desc: talking on the phone - right; proba: 1.0000; nObs: 387
  img_29251.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  1.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c2; desc: talking on the phone - right; proba: 0.5025; nObs: 1
  img_20398.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.      0.5025  0.      0.      0.      0.      0.      0.4975
  0.    ]
  next best class: hair and makeup


max Pby for cls: c3; desc: texting - left; proba: 1.0000; nObs: 81
  img_71015.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  1.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c3; desc: texting - left; proba: 0.5222; nObs: 1
  img_494.jpg:
  plot_occlusion:
  Proba:
[ 0.4778  0.      0.      0.5222  0.      0.      0.      0.      0.      0.    ]
  next best class: normal driving


max Pby for cls: c4; desc: talking on the phone - left; proba: 1.0000; nObs: 231
  img_18343.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  1.  0.  0.  0.  0.  0.]
min Pby for cls: c4; desc: talking on the phone - left; proba: 0.5223; nObs: 1
  img_62576.jpg:
  plot_occlusion:
  Proba:
[ 0.0013  0.      0.      0.      0.5223  0.      0.4764  0.      0.      0.    ]
  next best class: drinking


max Pby for cls: c5; desc: operating the radio; proba: 1.0000; nObs: 69
  img_44922.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  1.  0.  0.  0.  0.]
min Pby for cls: c5; desc: operating the radio; proba: 0.4260; nObs: 1
  img_91452.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.      0.2523  0.      0.      0.426   0.0153  0.3064  0.      0.    ]
  next best class: reaching behind


max Pby for cls: c6; desc: drinking; proba: 1.0000; nObs: 645
  img_15827.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  0.  1.  0.  0.  0.]
min Pby for cls: c6; desc: drinking; proba: 0.5227; nObs: 1
  img_36526.jpg:
  plot_occlusion:
  Proba:
[ 0.4773  0.      0.      0.      0.      0.      0.5227  0.      0.      0.    ]
  next best class: normal driving


max Pby for cls: c7; desc: reaching behind; proba: 1.0000; nObs: 309
  img_101868.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
min Pby for cls: c7; desc: reaching behind; proba: 0.5021; nObs: 1
  img_46643.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.      0.      0.      0.0188  0.      0.4791  0.5021  0.      0.    ]
  next best class: drinking


max Pby for cls: c8; desc: hair and makeup; proba: 1.0000; nObs: 195
  img_78749.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  1.  0.]
min Pby for cls: c8; desc: hair and makeup; proba: 0.4652; nObs: 1
  img_84310.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.      0.      0.      0.      0.      0.1883  0.3464  0.4652
  0.    ]
  next best class: reaching behind


max Pby for cls: c9; desc: talking to passenger; proba: 1.0000; nObs: 9
  img_89106.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  1.]
min Pby for cls: c9; desc: talking to passenger; proba: 0.8457; nObs: 1
  img_22899.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.      0.      0.      0.      0.      0.      0.      0.1543
  0.8457]
  next best class: hair and makeup
  predicting 79726 new obs...
    @  112 secs: obsIx:     0
    @  115 secs: obsIx:  8000
    @  127 secs: obsIx: 40000


max Pby for cls: c0; desc: normal driving; proba: 1.0000; nObs: 6320
  img_100.jpg:
  plot_occlusion:
  Proba:
[ 1.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c0; desc: normal driving; proba: 0.3896; nObs: 1
  img_26160.jpg:
  plot_occlusion:
  Proba:
[ 0.3896  0.3109  0.      0.      0.      0.      0.      0.      0.
  0.2995]
  next best class: texting - right


max Pby for cls: c1; desc: texting - right; proba: 1.0000; nObs: 5049
  img_100010.jpg:
  plot_occlusion:
  Proba:
[ 0.  1.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c1; desc: texting - right; proba: 0.3658; nObs: 1
  img_87391.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.3658  0.      0.      0.3168  0.      0.      0.      0.
  0.3175]
  next best class: talking to passenger


max Pby for cls: c2; desc: talking on the phone - right; proba: 1.0000; nObs: 2355
  img_100017.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  1.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c2; desc: talking on the phone - right; proba: 0.3595; nObs: 1
  img_47810.jpg:
  plot_occlusion:
  Proba:
[ 0.3258  0.      0.3595  0.      0.      0.      0.      0.3147  0.      0.    ]
  next best class: normal driving


max Pby for cls: c3; desc: texting - left; proba: 1.0000; nObs: 3476
  img_100000.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  1.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c3; desc: texting - left; proba: 0.4649; nObs: 1
  img_59302.jpg:
  plot_occlusion:
  Proba:
[ 0.2365  0.0001  0.      0.4649  0.2985  0.      0.      0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c4; desc: talking on the phone - left; proba: 1.0000; nObs: 7006
  img_100001.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  1.  0.  0.  0.  0.  0.]
min Pby for cls: c4; desc: talking on the phone - left; proba: 0.4063; nObs: 1
  img_47762.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.      0.      0.      0.4063  0.      0.2561  0.3375  0.      0.    ]
  next best class: reaching behind


max Pby for cls: c5; desc: operating the radio; proba: 1.0000; nObs: 4001
  img_10.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  1.  0.  0.  0.  0.]
min Pby for cls: c5; desc: operating the radio; proba: 0.5036; nObs: 1
  img_70083.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.      0.      0.      0.      0.5036  0.      0.      0.4964
  0.    ]
  next best class: hair and makeup


max Pby for cls: c6; desc: drinking; proba: 1.0000; nObs: 9212
  img_100002.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  0.  1.  0.  0.  0.]
min Pby for cls: c6; desc: drinking; proba: 0.4571; nObs: 1
  img_31636.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.      0.      0.      0.      0.      0.4571  0.      0.2087
  0.3342]
  next best class: talking to passenger


max Pby for cls: c7; desc: reaching behind; proba: 1.0000; nObs: 9209
  img_100003.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
min Pby for cls: c7; desc: reaching behind; proba: 0.4571; nObs: 1
  img_41180.jpg:
  plot_occlusion:
  Proba:
[ 0.1532  0.      0.      0.      0.      0.      0.      0.4571  0.3897
  0.    ]
  next best class: hair and makeup


max Pby for cls: c8; desc: hair and makeup; proba: 1.0000; nObs: 4555
  img_1000.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  1.  0.]
min Pby for cls: c8; desc: hair and makeup; proba: 0.3791; nObs: 1
  img_22366.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.      0.      0.      0.      0.      0.3398  0.2811  0.3791
  0.    ]
  next best class: drinking


max Pby for cls: c9; desc: talking to passenger; proba: 1.0000; nObs: 3105
  img_1.jpg:
  plot_occlusion:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  1.]
min Pby for cls: c9; desc: talking to passenger; proba: 0.5018; nObs: 1
  img_7457.jpg:
  plot_occlusion:
  Proba:
[ 0.      0.4982  0.      0.      0.      0.      0.      0.      0.
  0.5018]
  next best class: texting - right

  New prediction knts:
{'kntCls': (array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), array([ 9474,  7927,  4263,  5212,  9992,  5709, 13403, 12009,  6954,  4783]))}
  duration: 190 seconds
In [32]:
print '\n selMdl:'
glbwriteSubmission(glbINew, selYNewPby, 
    'img_05_fit_ML_RELU_SGD_Tfw_SFDD_ImgSz_' + str(glbImg['size']) + \
                   '_sbmt_sel.csv')
 selMdl:
                           img   c0            c1            c2            c3  \
img                                                                             
img_1.jpg            img_1.jpg  0.0  0.000000e+00  4.480205e-21  0.000000e+00   
img_10.jpg          img_10.jpg  0.0  0.000000e+00  0.000000e+00  7.320927e-32   
img_100.jpg        img_100.jpg  1.0  3.374610e-19  0.000000e+00  0.000000e+00   
img_1000.jpg      img_1000.jpg  0.0  0.000000e+00  0.000000e+00  0.000000e+00   
img_100000.jpg  img_100000.jpg  0.0  0.000000e+00  0.000000e+00  1.000000e+00   

                          c4            c5            c6            c7  \
img                                                                      
img_1.jpg       3.284638e-12  7.930196e-13  2.464396e-23  1.462144e-34   
img_10.jpg      0.000000e+00  1.000000e+00  0.000000e+00  0.000000e+00   
img_100.jpg     0.000000e+00  0.000000e+00  0.000000e+00  1.433873e-36   
img_1000.jpg    6.694481e-37  0.000000e+00  4.253485e-30  0.000000e+00   
img_100000.jpg  4.024444e-16  0.000000e+00  0.000000e+00  0.000000e+00   

                          c8            c9  
img                                         
img_1.jpg       5.738615e-10  1.000000e+00  
img_10.jpg      0.000000e+00  0.000000e+00  
img_100.jpg     0.000000e+00  2.577289e-17  
img_1000.jpg    1.000000e+00  0.000000e+00  
img_100000.jpg  0.000000e+00  0.000000e+00  
                         img        c0            c1            c2  \
img                                                                  
img_99994.jpg  img_99994.jpg  0.999856  1.442709e-04  0.000000e+00   
img_99995.jpg  img_99995.jpg  0.000000  0.000000e+00  0.000000e+00   
img_99996.jpg  img_99996.jpg  0.000000  1.000000e+00  0.000000e+00   
img_99998.jpg  img_99998.jpg  0.000000  4.431098e-30  4.036331e-15   
img_99999.jpg  img_99999.jpg  0.000000  0.000000e+00  0.000000e+00   

                         c3   c4            c5            c6   c7  \
img                                                                 
img_99994.jpg  0.000000e+00  0.0  1.268266e-19  2.533505e-09  0.0   
img_99995.jpg  3.746609e-36  0.0  3.181740e-31  1.000000e+00  0.0   
img_99996.jpg  0.000000e+00  0.0  0.000000e+00  0.000000e+00  0.0   
img_99998.jpg  0.000000e+00  0.0  0.000000e+00  1.000000e+00  0.0   
img_99999.jpg  0.000000e+00  0.0  5.780951e-11  1.000000e+00  0.0   

                         c8   c9  
img                               
img_99994.jpg  0.000000e+00  0.0  
img_99995.jpg  0.000000e+00  0.0  
img_99996.jpg  0.000000e+00  0.0  
img_99998.jpg  1.806214e-14  0.0  
img_99999.jpg  7.692414e-13  0.0  

exporting 79726 rows to img_05_fit_ML_RELU_SGD_Tfw_SFDD_ImgSz_64_sbmt_sel.csv...

Fit selected model to glbObsTrn

In [24]:
finMdlDf, finYVldPby, finYNewPby = fitMdlLgtRgrSGDTfw(
    glbXTrn, glbYTrn, 
    nObsFit = glbXTrn.shape[0], 
    nObsBtc = selMdlSrs['nObsBtc'][0],     
    rotatePby = selMdlSrs['rotatePby'][0],     
    rotateMaxAgl = selMdlSrs['rotateMaxAgl'][0],         
    # Ensure all Trn obs are used at least once
    nStepsTfw = max(selMdlSrs['nStepsTfw'][0], 
        glbXTrn.shape[0] * 1.0 / selMdlSrs['nObsBtc'][0] + 1), 
    lrnRateTfw = selMdlSrs['lrnRateTfw'][0],     
    visualize = True, newObs = True, verbose = True)

# selMdlDf, selYVldPby, selYNewPby = fitMdlLgtRgrSGDTfw(
#     glbXFit, glbYFit, 
#     nObsFit = glbXFit.shape[0], 
#     nObsBtc = selMdlSrs['nObsBtc'][0],     
#     rotatePby = selMdlSrs['rotatePby'][0],     
#     rotateMaxAgl = selMdlSrs['rotateMaxAgl'][0],         
#     nStepsTfw = selMdlSrs['nStepsTfw'][0], 
#     lrnRateTfw = selMdlSrs['lrnRateTfw'][0], 
#     visualize = True, newObs = True, verbose = True)
Logistic Regression (TensorFlow): nObsFit:22424; nObsBtc:    8; rotatePby: 0.1000; rotateMaxAgl:   2; nStepsTfw: 2804; lrnRateTfw:3.0000 
  visualize: True; newObs: True; verbose: True
('  tfwW:', <tf.Tensor 'Identity:0' shape=(4096, 10) dtype=float32>)
('  tfwB:', <tf.Tensor 'Identity_1:0' shape=(10,) dtype=float32>)
  Initialized
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:124: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:143: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
/usr/local/lib/python2.7/site-packages/ipykernel/__main__.py:126: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
  step     1(    0 secs): Minibatch rotation:angle: 0.7815
  step     6(    0 secs): Minibatch rotation:angle: 1.3900
  step    13(    0 secs): Minibatch rotation:angle: 1.4487
  step    34(    0 secs): Minibatch rotation:angle: 0.2647
  step    39(    0 secs): Minibatch rotation:angle: -0.4238
  step    40(    0 secs): Minibatch rotation:angle: -1.0228
  step    42(    0 secs): Minibatch rotation:angle: -1.5997
  step    73(    1 secs): Minibatch rotation:angle: -1.4536
  step    75(    1 secs): Minibatch rotation:angle: 0.7455
  step    78(    1 secs): Minibatch rotation:angle: -0.2561
  step    86(    1 secs): Minibatch rotation:angle: 0.0559
  step    89(    1 secs): Minibatch rotation:angle: 0.8329
  step    93(    1 secs): Minibatch rotation:angle: 0.1879
  step   101(    1 secs): Minibatch rotation:angle: 0.1547
  step   123(    1 secs): Minibatch rotation:angle: 0.4447
  step   134(    1 secs): Minibatch rotation:angle: -1.7246
  step   139(    1 secs): Minibatch rotation:angle: -0.6370
  step   148(    1 secs): Minibatch rotation:angle: -0.7290
  step   149(    1 secs): Minibatch rotation:angle: 0.6298
  step   168(    1 secs): Minibatch rotation:angle: 0.9559
  step   174(    1 secs): Minibatch rotation:angle: 1.4031
  step   177(    1 secs): Minibatch rotation:angle: 1.5177
  step   193(    1 secs): Minibatch rotation:angle: -1.5264
  step   208(    2 secs): Minibatch rotation:angle: 0.8651
  step   219(    2 secs): Minibatch rotation:angle: -0.7559
  step   227(    2 secs): Minibatch rotation:angle: -0.7687
  step   228(    2 secs): Minibatch rotation:angle: 0.7853
  step   229(    2 secs): Minibatch rotation:angle: 0.7060
  step   259(    2 secs): Minibatch rotation:angle: 1.1189
  step   262(    2 secs): Minibatch rotation:angle: 1.2409
  step   284(    2 secs): Minibatch rotation:angle: 1.2055
  step   302(    2 secs): Minibatch rotation:angle: -0.8014
  step   307(    2 secs): Minibatch rotation:angle: 1.5852
  step   320(    2 secs): Minibatch rotation:angle: -1.7845
  step   323(    2 secs): Minibatch rotation:angle: 0.6667
  step   355(    2 secs): Minibatch rotation:angle: -0.7972
  step   356(    2 secs): Minibatch rotation:angle: -1.0431
  step   380(    2 secs): Minibatch rotation:angle: 0.8782
  step   401(    4 secs): Minibatch rotation:angle: 1.0272
  step   406(    4 secs): Minibatch rotation:angle: 1.2680
  step   412(    4 secs): Minibatch rotation:angle: -0.3036
  step   427(    4 secs): Minibatch rotation:angle: 0.6773
  step   456(    4 secs): Minibatch rotation:angle: -0.2512
  step   457(    4 secs): Minibatch rotation:angle: 1.2892
  step   462(    4 secs): Minibatch rotation:angle: -1.4782
  step   520(    4 secs): Minibatch rotation:angle: 0.1854
  step   524(    4 secs): Minibatch rotation:angle: -0.2769
  step   544(    4 secs): Minibatch rotation:angle: -0.3829
  step   552(    4 secs): Minibatch rotation:angle: -0.8067
  step   555(    4 secs): Minibatch rotation:angle: -1.0371
  step   565(    4 secs): Minibatch rotation:angle: -0.0422
  step   581(    4 secs): Minibatch rotation:angle: -1.8645
  step   583(    4 secs): Minibatch rotation:angle: -0.3721
  step   587(    4 secs): Minibatch rotation:angle: -0.6783
  step   633(    5 secs): Minibatch rotation:angle: 0.2982
  step   644(    5 secs): Minibatch rotation:angle: -0.1618
  step   657(    5 secs): Minibatch rotation:angle: -0.7546
  step   658(    5 secs): Minibatch rotation:angle: 0.1138
  step   681(    5 secs): Minibatch rotation:angle: -1.7727
  step   682(    5 secs): Minibatch rotation:angle: 0.7245
  step   687(    5 secs): Minibatch rotation:angle: 1.4412
  step   689(    5 secs): Minibatch rotation:angle: -0.5182
  step   691(    5 secs): Minibatch rotation:angle: 0.6104
  step   700(    5 secs): Minibatch rotation:angle: 0.2777
  step   713(    5 secs): Minibatch rotation:angle: 0.4088
  step   731(    5 secs): Minibatch rotation:angle: 1.5995
  step   761(    5 secs): Minibatch rotation:angle: -0.1049
  step   764(    5 secs): Minibatch rotation:angle: -0.1286
  step   785(    5 secs): Minibatch rotation:angle: 0.2296
  step   795(    5 secs): Minibatch rotation:angle: -1.4570
  step   813(    7 secs): Minibatch rotation:angle: -1.5104
  step   837(    7 secs): Minibatch rotation:angle: 0.9490
  step   847(    7 secs): Minibatch rotation:angle: 1.2389
  step   857(    7 secs): Minibatch rotation:angle: 1.9708
  step   861(    7 secs): Minibatch rotation:angle: -1.3822
  step   877(    7 secs): Minibatch rotation:angle: -1.6069
  step   880(    7 secs): Minibatch rotation:angle: 1.4276
  step   882(    7 secs): Minibatch rotation:angle: 0.0323
  step   895(    7 secs): Minibatch rotation:angle: -0.7840
  step   909(    7 secs): Minibatch rotation:angle: 0.2200
  step   924(    7 secs): Minibatch rotation:angle: 0.9365
  step   939(    7 secs): Minibatch rotation:angle: 0.5616
  step   942(    7 secs): Minibatch rotation:angle: -1.3131
  step   945(    7 secs): Minibatch rotation:angle: 0.5496
  step   948(    7 secs): Minibatch rotation:angle: 1.8078
  step   952(    7 secs): Minibatch rotation:angle: 1.6791
  step   954(    7 secs): Minibatch rotation:angle: 1.3377
  step   969(    7 secs): Minibatch rotation:angle: 0.3555
  step   981(    7 secs): Minibatch rotation:angle: -0.8890
  step   992(    7 secs): Minibatch rotation:angle: -0.7087
  step  1003(    7 secs): Minibatch rotation:angle: -1.6007
  step  1020(    7 secs): Minibatch rotation:angle: -1.0628
  step  1032(    7 secs): Minibatch rotation:angle: -1.4750
  step  1048(    7 secs): Minibatch rotation:angle: 1.5043
  step  1057(    7 secs): Minibatch rotation:angle: 0.0029
  step  1061(    7 secs): Minibatch rotation:angle: 0.2589
  step  1067(    7 secs): Minibatch rotation:angle: -0.6912
  step  1075(    7 secs): Minibatch rotation:angle: -0.4388
  step  1078(    7 secs): Minibatch rotation:angle: -0.7461
  step  1110(    7 secs): Minibatch rotation:angle: -1.0476
  step  1130(    7 secs): Minibatch rotation:angle: 0.8604
  step  1139(    7 secs): Minibatch rotation:angle: 0.1264
  step  1141(    7 secs): Minibatch rotation:angle: -0.5500
  step  1146(    7 secs): Minibatch rotation:angle: 0.8126
  step  1151(    7 secs): Minibatch rotation:angle: -1.1652
  step  1153(    7 secs): Minibatch rotation:angle: 0.5463
  step  1180(    7 secs): Minibatch rotation:angle: 0.9390
  step  1182(    7 secs): Minibatch rotation:angle: -1.8405
  step  1189(    7 secs): Minibatch rotation:angle: -1.3134
  step  1197(    7 secs): Minibatch rotation:angle: -0.1215
  step  1204(    7 secs): Minibatch rotation:angle: -1.2543
  step  1208(    7 secs): Minibatch rotation:angle: 0.7490
  step  1229(    7 secs): Minibatch rotation:angle: 0.1293
  step  1237(    7 secs): Minibatch rotation:angle: 0.3663
  step  1266(    7 secs): Minibatch rotation:angle: -1.9999
  step  1278(    7 secs): Minibatch rotation:angle: 1.8027
  step  1295(    7 secs): Minibatch rotation:angle: 1.3164
  step  1297(    7 secs): Minibatch rotation:angle: 0.9677
  step  1299(    7 secs): Minibatch rotation:angle: 1.9622
  step  1325(    7 secs): Minibatch rotation:angle: -1.9778
  step  1328(    7 secs): Minibatch rotation:angle: -1.1786
  step  1334(    7 secs): Minibatch rotation:angle: -0.7078
  step  1336(    7 secs): Minibatch rotation:angle: -1.8895
  step  1359(    7 secs): Minibatch rotation:angle: -1.6903
  step  1382(    7 secs): Minibatch rotation:angle: 0.0515
  step  1385(    7 secs): Minibatch rotation:angle: 0.8232
  step  1387(    7 secs): Minibatch rotation:angle: 1.9280
  step  1404(    7 secs): Minibatch rotation:angle: -1.7674
  step  1415(    7 secs): Minibatch rotation:angle: -0.9821
  step  1418(    7 secs): Minibatch rotation:angle: 0.2995
  step  1434(    7 secs): Minibatch rotation:angle: 0.3138
  step  1447(    7 secs): Minibatch rotation:angle: -0.1445
  step  1468(    7 secs): Minibatch rotation:angle: 0.2396
  step  1472(    7 secs): Minibatch rotation:angle: -1.0896
  step  1480(    7 secs): Minibatch rotation:angle: 0.5134
  step  1484(    7 secs): Minibatch rotation:angle: 0.6300
  step  1512(    7 secs): Minibatch rotation:angle: 1.2379
  step  1520(    7 secs): Minibatch rotation:angle: 0.5878
  step  1532(    7 secs): Minibatch rotation:angle: 0.7924
  step  1544(    7 secs): Minibatch rotation:angle: -1.5924
  step  1546(    7 secs): Minibatch rotation:angle: 0.4798
  step  1551(    7 secs): Minibatch rotation:angle: 0.6005
  step  1569(    7 secs): Minibatch rotation:angle: -0.9395
  step  1594(    7 secs): Minibatch rotation:angle: 1.6593
  step  1600(    7 secs): Minibatch rotation:angle: 0.5128
  step  1647(    7 secs): Minibatch rotation:angle: 1.2361
  step  1663(    7 secs): Minibatch rotation:angle: -1.2202
  step  1693(    7 secs): Minibatch rotation:angle: -1.6133
  step  1695(    7 secs): Minibatch rotation:angle: -0.9869
  step  1701(    7 secs): Minibatch rotation:angle: -0.2891
  step  1709(    7 secs): Minibatch rotation:angle: 1.0592
  step  1715(    7 secs): Minibatch rotation:angle: -1.7232
  step  1716(    7 secs): Minibatch rotation:angle: 0.4602
  step  1721(    7 secs): Minibatch rotation:angle: 1.8439
  step  1723(    7 secs): Minibatch rotation:angle: 1.2296
  step  1743(    7 secs): Minibatch rotation:angle: 1.4123
  step  1746(    7 secs): Minibatch rotation:angle: 0.5527
  step  1747(    7 secs): Minibatch rotation:angle: -1.4935
  step  1768(    7 secs): Minibatch rotation:angle: -0.2607
  step  1772(    7 secs): Minibatch rotation:angle: 0.7055
  step  1781(    7 secs): Minibatch rotation:angle: 0.3354
  step  1817(    7 secs): Minibatch rotation:angle: -1.9580
  step  1821(    7 secs): Minibatch rotation:angle: -1.5412
  step  1825(    7 secs): Minibatch rotation:angle: -0.4509
  step  1827(    7 secs): Minibatch rotation:angle: 1.9688
  step  1851(    7 secs): Minibatch rotation:angle: -1.7624
  step  1857(    7 secs): Minibatch rotation:angle: 0.5838
  step  1862(    7 secs): Minibatch rotation:angle: -0.3668
  step  1874(    7 secs): Minibatch rotation:angle: -1.4491
  step  1875(    7 secs): Minibatch rotation:angle: -0.3541
  step  1888(    7 secs): Minibatch rotation:angle: 0.7662
  step  1894(    7 secs): Minibatch rotation:angle: 0.4572
  step  1905(    7 secs): Minibatch rotation:angle: -1.1159
  step  1906(    7 secs): Minibatch rotation:angle: -1.9946
  step  1915(    7 secs): Minibatch rotation:angle: 0.1886
  step  1923(    7 secs): Minibatch rotation:angle: 0.5597
  step  1938(    7 secs): Minibatch rotation:angle: -1.5014
  step  1940(    7 secs): Minibatch rotation:angle: -0.7812
  step  1941(    7 secs): Minibatch rotation:angle: -0.9926
  step  1977(    7 secs): Minibatch rotation:angle: 1.9638
  step  1978(    7 secs): Minibatch rotation:angle: -1.4872
  step  1991(    7 secs): Minibatch rotation:angle: 1.3604
  step  2008(   18 secs): Minibatch rotation:angle: -0.4081
  step  2014(   18 secs): Minibatch rotation:angle: -1.6980
  step  2027(   18 secs): Minibatch rotation:angle: -0.2367
  step  2030(   18 secs): Minibatch rotation:angle: -0.8204
  step  2041(   18 secs): Minibatch rotation:angle: -1.3729
  step  2046(   18 secs): Minibatch rotation:angle: -0.2749
  step  2081(   18 secs): Minibatch rotation:angle: -1.9513
  step  2084(   18 secs): Minibatch rotation:angle: -1.8022
  step  2098(   18 secs): Minibatch rotation:angle: 1.0991
  step  2100(   18 secs): Minibatch rotation:angle: -0.5681
  step  2101(   18 secs): Minibatch rotation:angle: -1.7471
  step  2111(   18 secs): Minibatch rotation:angle: -1.4369
  step  2132(   18 secs): Minibatch rotation:angle: -0.5205
  step  2148(   18 secs): Minibatch rotation:angle: 1.5780
  step  2153(   18 secs): Minibatch rotation:angle: 0.6324
  step  2158(   18 secs): Minibatch rotation:angle: 1.9805
  step  2159(   18 secs): Minibatch rotation:angle: 0.9734
  step  2164(   18 secs): Minibatch rotation:angle: 1.1774
  step  2172(   18 secs): Minibatch rotation:angle: 1.2144
  step  2185(   18 secs): Minibatch rotation:angle: -0.7179
  step  2203(   18 secs): Minibatch rotation:angle: -1.5074
  step  2205(   18 secs): Minibatch rotation:angle: 0.3687
  step  2233(   18 secs): Minibatch rotation:angle: -0.8576
  step  2243(   18 secs): Minibatch rotation:angle: -0.8914
  step  2249(   18 secs): Minibatch rotation:angle: 1.4322
  step  2250(   18 secs): Minibatch rotation:angle: 1.5765
  step  2258(   18 secs): Minibatch rotation:angle: -1.7482
  step  2259(   18 secs): Minibatch rotation:angle: 1.9248
  step  2265(   18 secs): Minibatch rotation:angle: -0.2367
  step  2322(   18 secs): Minibatch rotation:angle: -0.1462
  step  2334(   18 secs): Minibatch rotation:angle: -1.2451
  step  2343(   18 secs): Minibatch rotation:angle: -1.7421
  step  2344(   18 secs): Minibatch rotation:angle: 0.7753
  step  2345(   18 secs): Minibatch rotation:angle: -1.0354
  step  2347(   18 secs): Minibatch rotation:angle: 1.0084
  step  2350(   18 secs): Minibatch rotation:angle: -0.0563
  step  2355(   18 secs): Minibatch rotation:angle: 1.5616
  step  2371(   18 secs): Minibatch rotation:angle: 0.1832
  step  2420(   18 secs): Minibatch rotation:angle: 0.7866
  step  2423(   18 secs): Minibatch rotation:angle: -1.6549
  step  2424(   18 secs): Minibatch rotation:angle: 0.6501
  step  2436(   18 secs): Minibatch rotation:angle: -1.9990
  step  2441(   18 secs): Minibatch rotation:angle: 1.3462
  step  2470(   18 secs): Minibatch rotation:angle: 1.1106
  step  2472(   18 secs): Minibatch rotation:angle: -1.1674
  step  2474(   18 secs): Minibatch rotation:angle: 1.3391
  step  2486(   18 secs): Minibatch rotation:angle: -1.1047
  step  2505(   18 secs): Minibatch rotation:angle: -1.2807
  step  2520(   18 secs): Minibatch rotation:angle: 1.4115
  step  2524(   18 secs): Minibatch rotation:angle: -1.5249
  step  2537(   18 secs): Minibatch rotation:angle: -0.5955
  step  2545(   18 secs): Minibatch rotation:angle: 0.4093
  step  2572(   18 secs): Minibatch rotation:angle: -1.3984
  step  2573(   18 secs): Minibatch rotation:angle: 1.7442
  step  2576(   18 secs): Minibatch rotation:angle: -1.2091
  step  2592(   18 secs): Minibatch rotation:angle: -0.3338
  step  2594(   18 secs): Minibatch rotation:angle: 0.5814
  step  2609(   18 secs): Minibatch rotation:angle: 0.4164
  step  2611(   18 secs): Minibatch rotation:angle: -1.0385
  step  2639(   18 secs): Minibatch rotation:angle: -0.3355
  step  2640(   18 secs): Minibatch rotation:angle: 0.6962
  step  2642(   18 secs): Minibatch rotation:angle: -0.5901
  step  2653(   18 secs): Minibatch rotation:angle: 1.9364
  step  2667(   18 secs): Minibatch rotation:angle: -0.9125
  step  2669(   18 secs): Minibatch rotation:angle: -1.4134
  step  2670(   18 secs): Minibatch rotation:angle: -0.4466
  step  2683(   18 secs): Minibatch rotation:angle: 1.3829
  step  2685(   18 secs): Minibatch rotation:angle: 0.2787
  step  2690(   18 secs): Minibatch rotation:angle: -1.5205
  step  2740(   18 secs): Minibatch rotation:angle: 0.1628
  step  2741(   18 secs): Minibatch rotation:angle: 0.3390
  step  2746(   18 secs): Minibatch rotation:angle: -0.3084
  step  2750(   18 secs): Minibatch rotation:angle: 1.9089
  step  2755(   18 secs): Minibatch rotation:angle: -0.3149
  step  2758(   18 secs): Minibatch rotation:angle: 1.7752
  step  2764(   18 secs): Minibatch rotation:angle: 1.7116
  step  2765(   18 secs): Minibatch rotation:angle: -1.5599
  step  2780(   18 secs): Minibatch rotation:angle: -1.0074
  step  2782(   18 secs): Minibatch rotation:angle: -1.2068
  step  2791(   18 secs): Minibatch rotation:angle: 1.9188
  step  2800(   18 secs): Minibatch rotation:angle: 0.4213
  step  2803(   18 secs): Minibatch rotation:angle: -0.2262

  Vld accuracy:0.8332
[ 0.7045  0.91    0.7876  0.7314  1.      0.9408  0.8781  0.9914  0.3379
  0.9978]
[[341   0   0   1 113   2   0   3   0  24]
 [  0 435   0   0  20   2   1  15   0   5]
 [  0   0 356   0  32   0  33  25   0   6]
 [  0   0   0 324 119   0   0   0   0   0]
 [  0   0   0   0 459   0   0   0   0   0]
 [  1   0   0   0  17 397   1   0   0   6]
 [  0   0   0   0  44   0 389   5   0   5]
 [  0   0   0   0   2   0   1 347   0   0]
 [  1   1   1   0  89   0  50  71 123  28]
 [  0   0   0   0   0   0   0   1   0 451]]
  Vld  logLoss:4.8369
[ 0.9739  0.2233  0.6196  0.6802  0.      0.1763  0.3445  0.0209  1.7902
  0.008 ]


max Pby for cls: c0; desc: normal driving; proba: 1.0000; nObs: 320
  img_62023.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 1.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c0; desc: normal driving; proba: 0.6795; nObs: 1
  img_80584.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.6795  0.      0.      0.      0.      0.      0.      0.      0.
  0.3205]
  next best class: talking to passenger


max Pby for cls: c1; desc: texting - right; proba: 1.0000; nObs: 426
  img_89322.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  1.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c1; desc: texting - right; proba: 0.8060; nObs: 1
  img_83254.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.     0.806  0.     0.     0.     0.194  0.     0.     0.     0.   ]
  next best class: operating the radio


max Pby for cls: c2; desc: talking on the phone - right; proba: 1.0000; nObs: 342
  img_87211.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  1.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c2; desc: talking on the phone - right; proba: 0.6004; nObs: 1
  img_53195.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.6004  0.      0.3996  0.      0.      0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c3; desc: texting - left; proba: 1.0000; nObs: 288
  img_77361.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  1.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c3; desc: texting - left; proba: 0.5175; nObs: 1
  img_94042.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.5175  0.4825  0.      0.      0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c4; desc: talking on the phone - left; proba: 1.0000; nObs: 807
  img_78749.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  1.  0.  0.  0.  0.  0.]
min Pby for cls: c4; desc: talking on the phone - left; proba: 0.5045; nObs: 1
  img_12442.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.4955  0.5045  0.      0.      0.      0.      0.    ]
  next best class: texting - left


max Pby for cls: c5; desc: operating the radio; proba: 1.0000; nObs: 398
  img_70461.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  1.  0.  0.  0.  0.]
min Pby for cls: c5; desc: operating the radio; proba: 0.8562; nObs: 1
  img_54029.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.1438  0.      0.      0.      0.8562  0.      0.      0.      0.    ]
  next best class: texting - right


max Pby for cls: c6; desc: drinking; proba: 1.0000; nObs: 440
  img_68722.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  1.  0.  0.  0.]
min Pby for cls: c6; desc: drinking; proba: 0.7608; nObs: 1
  img_32199.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.2392  0.      0.7608  0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c7; desc: reaching behind; proba: 1.0000; nObs: 433
  img_29251.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
min Pby for cls: c7; desc: reaching behind; proba: 0.4930; nObs: 1
  img_88262.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.0498  0.      0.      0.      0.4572  0.493   0.      0.    ]
  next best class: drinking


max Pby for cls: c8; desc: hair and makeup; proba: 1.0000; nObs: 107
  img_8759.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  1.  0.]
min Pby for cls: c8; desc: hair and makeup; proba: 0.8165; nObs: 1
  img_9578.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.1835  0.      0.      0.      0.8165
  0.    ]
  next best class: talking on the phone - left


max Pby for cls: c9; desc: talking to passenger; proba: 1.0000; nObs: 497
  img_24934.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  1.]
min Pby for cls: c9; desc: talking to passenger; proba: 0.8207; nObs: 1
  img_60533.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.1793  0.      0.      0.      0.
  0.8207]
  next best class: talking on the phone - left
  predicting 79726 new obs...
    @   68 secs: obsIx:     0
    @   69 secs: obsIx:  8000
    @   74 secs: obsIx: 40000


max Pby for cls: c0; desc: normal driving; proba: 1.0000; nObs: 3083
  img_100.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 1.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c0; desc: normal driving; proba: 0.5038; nObs: 1
  img_91731.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.5038  0.      0.      0.      0.4962  0.      0.      0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c1; desc: texting - right; proba: 1.0000; nObs: 3904
  img_100003.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  1.  0.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c1; desc: texting - right; proba: 0.4488; nObs: 1
  img_58091.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.4488  0.      0.      0.2213  0.      0.      0.      0.
  0.3298]
  next best class: talking to passenger


max Pby for cls: c2; desc: talking on the phone - right; proba: 1.0000; nObs: 1733
  img_10001.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  1.  0.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c2; desc: talking on the phone - right; proba: 0.5096; nObs: 1
  img_57784.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.5096  0.      0.      0.      0.      0.      0.
  0.4904]
  next best class: talking to passenger


max Pby for cls: c3; desc: texting - left; proba: 1.0000; nObs: 3918
  img_10.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  1.  0.  0.  0.  0.  0.  0.]
min Pby for cls: c3; desc: texting - left; proba: 0.5045; nObs: 1
  img_78739.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.5045  0.0001  0.      0.      0.      0.
  0.4955]
  next best class: talking to passenger


max Pby for cls: c4; desc: talking on the phone - left; proba: 1.0000; nObs: 24812
  img_1000.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  1.  0.  0.  0.  0.  0.]
min Pby for cls: c4; desc: talking on the phone - left; proba: 0.4816; nObs: 1
  img_68076.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.4636  0.4816  0.      0.      0.      0.
  0.0547]
  next best class: texting - left


max Pby for cls: c5; desc: operating the radio; proba: 1.0000; nObs: 5699
  img_100001.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  1.  0.  0.  0.  0.]
min Pby for cls: c5; desc: operating the radio; proba: 0.3664; nObs: 1
  img_78625.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.2851  0.      0.      0.      0.3485  0.3664  0.      0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c6; desc: drinking; proba: 1.0000; nObs: 5312
  img_100004.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  1.  0.  0.  0.]
min Pby for cls: c6; desc: drinking; proba: 0.5082; nObs: 1
  img_48373.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.4918  0.      0.5082  0.      0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c7; desc: reaching behind; proba: 1.0000; nObs: 6124
  img_100005.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  1.  0.  0.]
min Pby for cls: c7; desc: reaching behind; proba: 0.5014; nObs: 1
  img_22445.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.4986  0.      0.      0.5014  0.      0.    ]
  next best class: talking on the phone - left


max Pby for cls: c8; desc: hair and makeup; proba: 1.0000; nObs: 4040
  img_100035.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  1.  0.]
min Pby for cls: c8; desc: hair and makeup; proba: 0.5028; nObs: 1
  img_70747.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.      0.      0.      0.      0.      0.      0.5028
  0.4972]
  next best class: talking to passenger


max Pby for cls: c9; desc: talking to passenger; proba: 1.0000; nObs: 11551
  img_100024.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.  0.  0.  0.  0.  0.  0.  0.  0.  1.]
min Pby for cls: c9; desc: talking to passenger; proba: 0.4451; nObs: 1
  img_89849.jpg:
  plot_occlusion:
  display_weight:
  Proba:
[ 0.      0.      0.2253  0.      0.      0.      0.      0.3296  0.
  0.4451]
  next best class: reaching behind

  New prediction knts:
{'kntCls': (array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]), array([ 3619,  4408,  2109,  4576, 27385,  6501,  6198,  6814,  4881, 13235]))}
  duration: 122 seconds
In [25]:
print finMdlDf
               id  lrnRateTfw  nObsBtc  nObsFit  nStepsTfw  rotateMaxAgl  \
0  LgtRgr.SGD.tfw         3.0      8.0    22424     2804.0             2   

   rotatePby    accVld                                          accVldCls  \
0        0.1  0.833218  {u'accCls': [0.704545454545, 0.910041841004, 0...   

   logLossVld                                      logLossVldCls  \
0    4.836929  {u'logLossCls': [0.973879753517, 0.22334474905...   

                                             predNew  \
0  {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   

                                               model  duration  
0  <tensorflow.python.client.session.Session obje...       122  
In [26]:
glbMdlDf = glbMdlDf.append(finMdlDf)
glbMdlDf = glbMdlDf.set_index(['id'] + srchParamsDct.keys(), drop = False)
glbMdlDf = glbMdlDf.sort_values(
                ['nObsFit', 'accVld', 'logLossVld', 'duration'], 
    ascending = [False    , True    , False,        False])
print(glbMdlDf[list(set(glbMdlDf.columns) - 
                    set(['id'] + srchParamsDct.keys()))])
                                                                                                                    accVldCls  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.SGD.tfw  2804.0   22424.0 0.1       8.0      3.0       2             {u'accCls': [0.704545454545, 0.910041841004, 0...   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'accCls': [0.989669421488, 0.991631799163, 0...   
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.5       4.0      3.0       10            {u'accCls': [0.297520661157, 0.081589958159, 0...   
                100.0    18077.0 0.1       16.0     1.0       10            {u'accCls': [0.0, 0.150627615063, 0.0, 0.00225...   
                1000.0   18077.0 0.0       16.0     2.0       10            {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              1             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              0             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                                              2             {u'accCls': [0.495867768595, 0.0397489539749, ...   
                                 0.1       16.0     3.0       10            {u'accCls': [0.528925619835, 0.0523012552301, ...   
                                           4.0      3.0       1             {u'accCls': [0.545454545455, 0.0690376569038, ...   
                                           8.0      2.0       0             {u'accCls': [0.132231404959, 0.010460251046, 0...   
                                 0.0       8.0      2.0       10            {u'accCls': [0.132231404959, 0.010460251046, 0...   
                                                              1             {u'accCls': [0.132231404959, 0.010460251046, 0...   
                                                              0             {u'accCls': [0.132231404959, 0.010460251046, 0...   
                                                              2             {u'accCls': [0.132231404959, 0.010460251046, 0...   
                                 0.5       4.0      2.0       10            {u'accCls': [0.328512396694, 0.092050209205, 0...   
                                           8.0      3.0       10            {u'accCls': [0.0433884297521, 0.202928870293, ...   
                                           16.0     3.0       10            {u'accCls': [0.386363636364, 0.119246861925, 0...   
                                 0.0       8.0      10.0      10            {u'accCls': [0.51652892562, 0.0292887029289, 0...   
                                 0.1       16.0     1.0       0             {u'accCls': [0.340909090909, 0.169456066946, 0...   
                                 0.0       16.0     1.0       10            {u'accCls': [0.340909090909, 0.169456066946, 0...   
                                                              1             {u'accCls': [0.340909090909, 0.169456066946, 0...   
                                                              2             {u'accCls': [0.340909090909, 0.169456066946, 0...   
                                                              0             {u'accCls': [0.340909090909, 0.169456066946, 0...   
                                 0.1       4.0      2.0       2             {u'accCls': [0.564049586777, 0.673640167364, 0...   
                                           8.0      2.0       3             {u'accCls': [0.202479338843, 0.117154811715, 0...   
                                           16.0     2.0       10            {u'accCls': [0.252066115702, 0.10460251046, 0....   
                                 0.0       8.0      4.0       10            {u'accCls': [0.229338842975, 0.00418410041841,...   
                                                              1             {u'accCls': [0.229338842975, 0.00418410041841,...   
...                                                                                                                       ...   
                                 0.1       8.0      3.0       0             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                 0.0       8.0      3.0       1             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              0             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                                              2             {u'accCls': [0.460743801653, 0.640167364017, 0...   
                                 0.1       8.0      2.0       1             {u'accCls': [0.338842975207, 0.347280334728, 0...   
                                                    1.0       2             {u'accCls': [0.448347107438, 0.44769874477, 0....   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             {u'accCls': [0.504132231405, 0.435146443515, 0...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            {u'accCls': [0.0, 0.150627615063, 0.0, 0.00225...   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  0.1       0             {u'accCls': [0.169421487603, 0.144351464435, 0...   
                                                    1.0       0             {u'accCls': [0.289256198347, 0.182008368201, 0...   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             {u'accCls': [0.456611570248, 0.380753138075, 0...   
LgtRgr.SGD.tfw  1000.0   9000.0  0.1       8.0      3.0       2             {u'accCls': [0.607438016529, 0.219665271967, 0...   
                         8000.0  0.1       8.0      3.0       2             {u'accCls': [0.553719008264, 0.610878661088, 0...   
                         7000.0  0.1       8.0      3.0       2             {u'accCls': [0.431818181818, 0.558577405858, 0...   
                         6000.0  0.1       8.0      3.0       2             {u'accCls': [0.181818181818, 0.671548117155, 0...   
                         5000.0  0.1       8.0      3.0       2             {u'accCls': [0.543388429752, 0.535564853556, 0...   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                                                           NaN   
                         2000.0  0.0       2000.0  -1.0       0                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             {u'accCls': [0.150826446281, 0.142259414226, 0...   
LgtRgr.SGD.tfw  100.0    1000.0  0.1       16.0     1.0       10            {u'accCls': [0.136363636364, 0.0230125523013, ...   
                1000.0   1000.0  0.1       8.0      3.0       2             {u'accCls': [0.204545454545, 0.0334728033473, ...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   1.0       0             {u'accCls': [0.423553719008, 0.182008368201, 0...   
                                                    10.0      0             {u'accCls': [0.646694214876, 0.0564853556485, ...   
LgtRgr.skl     -1.0      1000.0  0.0       1000.0  -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             {u'accCls': [0.0185950413223, 0.133891213389, ...   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                                                           NaN   

                                                                           bestFit  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl           
LgtRgr.SGD.tfw  2804.0   22424.0 0.1       8.0      3.0       2                NaN   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0              False   
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.5       4.0      3.0       10             False   
                100.0    18077.0 0.1       16.0     1.0       10             False   
                1000.0   18077.0 0.0       16.0     2.0       10             False   
                                                              1              False   
                                                              0              False   
                                                              2              False   
                                 0.1       16.0     3.0       10             False   
                                           4.0      3.0       1              False   
                                           8.0      2.0       0              False   
                                 0.0       8.0      2.0       10             False   
                                                              1              False   
                                                              0              False   
                                                              2              False   
                                 0.5       4.0      2.0       10             False   
                                           8.0      3.0       10             False   
                                           16.0     3.0       10             False   
                                 0.0       8.0      10.0      10             False   
                                 0.1       16.0     1.0       0              False   
                                 0.0       16.0     1.0       10             False   
                                                              1              False   
                                                              2              False   
                                                              0              False   
                                 0.1       4.0      2.0       2              False   
                                           8.0      2.0       3              False   
                                           16.0     2.0       10             False   
                                 0.0       8.0      4.0       10             False   
                                                              1              False   
...                                                                            ...   
                                 0.1       8.0      3.0       0              False   
                                 0.0       8.0      3.0       1              False   
                                                              0              False   
                                                              2              False   
                                 0.1       8.0      2.0       1              False   
                                                    1.0       2              False   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2               True   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0              False   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10             False   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  0.1       0              False   
                                                    1.0       0              False   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2              False   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0              False   
LgtRgr.SGD.tfw  1000.0   9000.0  0.1       8.0      3.0       2              False   
                         8000.0  0.1       8.0      3.0       2              False   
                         7000.0  0.1       8.0      3.0       2              False   
                         6000.0  0.1       8.0      3.0       2              False   
                         5000.0  0.1       8.0      3.0       2              False   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0              False   
                         2000.0  0.0       2000.0  -1.0       0              False   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0              False   
LgtRgr.SGD.tfw  100.0    1000.0  0.1       16.0     1.0       10             False   
                1000.0   1000.0  0.1       8.0      3.0       2              False   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   1.0       0              False   
                                                    10.0      0              False   
LgtRgr.skl     -1.0      1000.0  0.0       1000.0  -1.0       0              False   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2              False   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0              False   

                                                                            logLossVld  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl               
LgtRgr.SGD.tfw  2804.0   22424.0 0.1       8.0      3.0       2               4.836929   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0               0.193149   
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0               0.018463   
LgtRgr.SGD.tfw  1000.0   18077.0 0.5       4.0      3.0       10             26.843734   
                100.0    18077.0 0.1       16.0     1.0       10             24.085776   
                1000.0   18077.0 0.0       16.0     2.0       10             25.605293   
                                                              1              25.605293   
                                                              0              25.605293   
                                                              2              25.605293   
                                 0.1       16.0     3.0       10             25.966046   
                                           4.0      3.0       1              26.212732   
                                           8.0      2.0       0              24.909087   
                                 0.0       8.0      2.0       10             24.909087   
                                                              1              24.909087   
                                                              0              24.909087   
                                                              2              24.909087   
                                 0.5       4.0      2.0       10             24.777048   
                                           8.0      3.0       10             24.417234   
                                           16.0     3.0       10             24.161626   
                                 0.0       8.0      10.0      10             24.927648   
                                 0.1       16.0     1.0       0              20.958448   
                                 0.0       16.0     1.0       10             20.958448   
                                                              1              20.958448   
                                                              2              20.958448   
                                                              0              20.958448   
                                 0.1       4.0      2.0       2              24.175734   
                                           8.0      2.0       3              23.044421   
                                           16.0     2.0       10             22.249012   
                                 0.0       8.0      4.0       10             24.110602   
                                                              1              24.110602   
...                                                                                ...   
                                 0.1       8.0      3.0       0              20.948740   
                                 0.0       8.0      3.0       1              20.948740   
                                                              0              20.948740   
                                                              2              20.948740   
                                 0.1       8.0      2.0       1              20.091985   
                                                    1.0       2              17.898932   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0              19.209913   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2              20.546733   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0               3.085191   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10             24.085776   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  0.1       0               8.912652   
                                                    1.0       0               9.502959   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0               2.885114   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2              20.546733   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0              18.995890   
LgtRgr.SGD.tfw  1000.0   9000.0  0.1       8.0      3.0       2              20.546733   
                         8000.0  0.1       8.0      3.0       2              20.345963   
                         7000.0  0.1       8.0      3.0       2              20.307083   
                         6000.0  0.1       8.0      3.0       2              21.354761   
                         5000.0  0.1       8.0      3.0       2              21.899301   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0               2.610439   
                         2000.0  0.0       2000.0  -1.0       0               2.498749   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0              12.600104   
LgtRgr.SGD.tfw  100.0    1000.0  0.1       16.0     1.0       10             18.141110   
                1000.0   1000.0  0.1       8.0      3.0       2              25.728109   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   1.0       0              14.714048   
                                                    10.0      0              24.274683   
LgtRgr.skl     -1.0      1000.0  0.0       1000.0  -1.0       0               2.539650   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2              25.837055   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0               2.497940   

                                                                                                                      predNew  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.SGD.tfw  2804.0   22424.0 0.1       8.0      3.0       2             {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'kntCls': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.5       4.0      3.0       10                                                          NaN   
                100.0    18077.0 0.1       16.0     1.0       10                                                          NaN   
                1000.0   18077.0 0.0       16.0     2.0       10                                                          NaN   
                                                              1                                                           NaN   
                                                              0                                                           NaN   
                                                              2                                                           NaN   
                                 0.1       16.0     3.0       10                                                          NaN   
                                           4.0      3.0       1                                                           NaN   
                                           8.0      2.0       0                                                           NaN   
                                 0.0       8.0      2.0       10                                                          NaN   
                                                              1                                                           NaN   
                                                              0                                                           NaN   
                                                              2                                                           NaN   
                                 0.5       4.0      2.0       10                                                          NaN   
                                           8.0      3.0       10                                                          NaN   
                                           16.0     3.0       10                                                          NaN   
                                 0.0       8.0      10.0      10                                                          NaN   
                                 0.1       16.0     1.0       0                                                           NaN   
                                 0.0       16.0     1.0       10                                                          NaN   
                                                              1                                                           NaN   
                                                              2                                                           NaN   
                                                              0                                                           NaN   
                                 0.1       4.0      2.0       2                                                           NaN   
                                           8.0      2.0       3                                                           NaN   
                                           16.0     2.0       10                                                          NaN   
                                 0.0       8.0      4.0       10                                                          NaN   
                                                              1                                                           NaN   
...                                                                                                                       ...   
                                 0.1       8.0      3.0       0                                                           NaN   
                                 0.0       8.0      3.0       1                                                           NaN   
                                                              0                                                           NaN   
                                                              2                                                           NaN   
                                 0.1       8.0      2.0       1                                                           NaN   
                                                    1.0       2                                                           NaN   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                                                          NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  0.1       0                                                           NaN   
                                                    1.0       0                                                           NaN   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                                                           NaN   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   9000.0  0.1       8.0      3.0       2                                                           NaN   
                         8000.0  0.1       8.0      3.0       2                                                           NaN   
                         7000.0  0.1       8.0      3.0       2                                                           NaN   
                         6000.0  0.1       8.0      3.0       2                                                           NaN   
                         5000.0  0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
                         2000.0  0.0       2000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                                                           NaN   
LgtRgr.SGD.tfw  100.0    1000.0  0.1       16.0     1.0       10                                                          NaN   
                1000.0   1000.0  0.1       8.0      3.0       2                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   1.0       0                                                           NaN   
                                                    10.0      0                                                           NaN   
LgtRgr.skl     -1.0      1000.0  0.0       1000.0  -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                                                           NaN   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0             {u'clsKnt': ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [...   

                                                                                                                logLossVldCls  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                      
LgtRgr.SGD.tfw  2804.0   22424.0 0.1       8.0      3.0       2             {u'logLossCls': [0.973879753517, 0.22334474905...   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             {u'logLossCls': [0.0123335882818, 0.0241534716...   
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   18077.0 0.5       4.0      3.0       10            {u'logLossCls': [2.62356084168, 3.42588099594,...   
                100.0    18077.0 0.1       16.0     1.0       10            {u'logLossCls': [3.84558724986, 2.69565642157,...   
                1000.0   18077.0 0.0       16.0     2.0       10            {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              1             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              0             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                                              2             {u'logLossCls': [1.86638576386, 3.42782085718,...   
                                 0.1       16.0     3.0       10            {u'logLossCls': [1.71310413171, 3.4687167196, ...   
                                           4.0      3.0       1             {u'logLossCls': [1.71708309944, 3.4968377777, ...   
                                           8.0      2.0       0             {u'logLossCls': [3.05751075809, 3.73295341141,...   
                                 0.0       8.0      2.0       10            {u'logLossCls': [3.05751075809, 3.73295341141,...   
                                                              1             {u'logLossCls': [3.05751075809, 3.73295341141,...   
                                                              0             {u'logLossCls': [3.05751075809, 3.73295341141,...   
                                                              2             {u'logLossCls': [3.05751075809, 3.73295341141,...   
                                 0.5       4.0      2.0       10            {u'logLossCls': [2.38429593137, 3.32281736573,...   
                                           8.0      3.0       10            {u'logLossCls': [3.61623259217, 2.83198596779,...   
                                           16.0     3.0       10            {u'logLossCls': [2.15663510596, 3.1841831293, ...   
                                 0.0       8.0      10.0      10            {u'logLossCls': [1.82418636316, 3.66306265443,...   
                                 0.1       16.0     1.0       0             {u'logLossCls': [2.09243845599, 2.30268346691,...   
                                 0.0       16.0     1.0       10            {u'logLossCls': [2.09243845599, 2.30268346691,...   
                                                              1             {u'logLossCls': [2.09243845599, 2.30268346691,...   
                                                              2             {u'logLossCls': [2.09243845599, 2.30268346691,...   
                                                              0             {u'logLossCls': [2.09243845599, 2.30268346691,...   
                                 0.1       4.0      2.0       2             {u'logLossCls': [1.59263670019, 1.19242519276,...   
                                           8.0      2.0       3             {u'logLossCls': [2.7750707387, 3.1253805868, 3...   
                                           16.0     2.0       10            {u'logLossCls': [2.42199459643, 3.05959930614,...   
                                 0.0       8.0      4.0       10            {u'logLossCls': [2.81500682324, 3.7814798951, ...   
                                                              1             {u'logLossCls': [2.81500682324, 3.7814798951, ...   
...                                                                                                                       ...   
                                 0.1       8.0      3.0       0             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                 0.0       8.0      3.0       1             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              0             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                                              2             {u'logLossCls': [1.99287215213, 1.25414623142,...   
                                 0.1       8.0      2.0       1             {u'logLossCls': [2.4098162987, 2.1249522721, 2...   
                                                    1.0       2             {u'logLossCls': [1.7477126908, 1.45845704706, ...   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             {u'logLossCls': [1.72596805748, 1.7853875361, ...   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            {u'logLossCls': [3.84558724986, 2.69565642157,...   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  0.1       0             {u'logLossCls': [1.11536194976, 1.25718941188,...   
                                                    1.0       0             {u'logLossCls': [1.14059053163, 1.46723165909,...   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             {u'logLossCls': [1.84540699409, 1.93896956479,...   
LgtRgr.SGD.tfw  1000.0   9000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.48863261945, 2.76463156066,...   
                         8000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.5257602538, 1.31972597838, ...   
                         7000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.06754908637, 1.51088086827,...   
                         6000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.97387028973, 1.20522205183,...   
                         5000.0  0.1       8.0      3.0       2             {u'logLossCls': [1.57533202071, 1.59023941247,...   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                                                           NaN   
                         2000.0  0.0       2000.0  -1.0       0                                                           NaN   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             {u'logLossCls': [1.47411393905, 2.08387227918,...   
LgtRgr.SGD.tfw  100.0    1000.0  0.1       16.0     1.0       10            {u'logLossCls': [2.1826821181, 3.34540505739, ...   
                1000.0   1000.0  0.1       8.0      3.0       2             {u'logLossCls': [2.84808429073, 3.58756550329,...   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   1.0       0             {u'logLossCls': [0.842354858019, 1.17531354279...   
                                                    10.0      0             {u'logLossCls': [1.28781316316, 3.51519487621,...   
LgtRgr.skl     -1.0      1000.0  0.0       1000.0  -1.0       0                                                           NaN   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             {u'logLossCls': [3.67759601248, 3.22267129616,...   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                                                           NaN   

                                                                              accVld  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.SGD.tfw  2804.0   22424.0 0.1       8.0      3.0       2             0.833218   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0             0.987348   
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0             1.000000   
LgtRgr.SGD.tfw  1000.0   18077.0 0.5       4.0      3.0       10            0.208420   
                100.0    18077.0 0.1       16.0     1.0       10            0.210950   
                1000.0   18077.0 0.0       16.0     2.0       10            0.214861   
                                                              1             0.214861   
                                                              0             0.214861   
                                                              2             0.214861   
                                 0.1       16.0     3.0       10            0.219692   
                                           4.0      3.0       1             0.226823   
                                           8.0      2.0       0             0.241776   
                                 0.0       8.0      2.0       10            0.241776   
                                                              1             0.241776   
                                                              0             0.241776   
                                                              2             0.241776   
                                 0.5       4.0      2.0       10            0.252588   
                                           8.0      3.0       10            0.262020   
                                           16.0     3.0       10            0.268231   
                                 0.0       8.0      10.0      10            0.269841   
                                 0.1       16.0     1.0       0             0.270761   
                                 0.0       16.0     1.0       10            0.270761   
                                                              1             0.270761   
                                                              2             0.270761   
                                                              0             0.270761   
                                 0.1       4.0      2.0       2             0.272602   
                                           8.0      2.0       3             0.272832   
                                           16.0     2.0       10            0.273522   
                                 0.0       8.0      4.0       10            0.276282   
                                                              1             0.276282   
...                                                                              ...   
                                 0.1       8.0      3.0       0             0.357028   
                                 0.0       8.0      3.0       1             0.357028   
                                                              0             0.357028   
                                                              2             0.357028   
                                 0.1       8.0      2.0       1             0.357488   
                                                    1.0       2             0.361859   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0             0.375201   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2             0.381643   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0             0.342535   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10            0.210950   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  0.1       0             0.251208   
                                                    1.0       0             0.319991   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0             0.358638   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2             0.381643   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0             0.384173   
LgtRgr.SGD.tfw  1000.0   9000.0  0.1       8.0      3.0       2             0.381643   
                         8000.0  0.1       8.0      3.0       2             0.378882   
                         7000.0  0.1       8.0      3.0       2             0.375431   
                         6000.0  0.1       8.0      3.0       2             0.339545   
                         5000.0  0.1       8.0      3.0       2             0.320911   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0             0.363699   
                         2000.0  0.0       2000.0  -1.0       0             0.341385   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0             0.173453   
LgtRgr.SGD.tfw  100.0    1000.0  0.1       16.0     1.0       10            0.212790   
                1000.0   1000.0  0.1       8.0      3.0       2             0.224983   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   1.0       0             0.255809   
                                                    10.0      0             0.273522   
LgtRgr.skl     -1.0      1000.0  0.0       1000.0  -1.0       0             0.333333   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2             0.224753   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0             0.307108   

                                                                            duration  \
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl             
LgtRgr.SGD.tfw  2804.0   22424.0 0.1       8.0      3.0       2                  122   
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                  743   
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                  874   
LgtRgr.SGD.tfw  1000.0   18077.0 0.5       4.0      3.0       10                  12   
                100.0    18077.0 0.1       16.0     1.0       10                   2   
                1000.0   18077.0 0.0       16.0     2.0       10                  11   
                                                              1                   11   
                                                              0                   11   
                                                              2                   10   
                                 0.1       16.0     3.0       10                  13   
                                           4.0      3.0       1                    9   
                                           8.0      2.0       0                   10   
                                 0.0       8.0      2.0       10                   9   
                                                              1                    9   
                                                              0                    8   
                                                              2                    8   
                                 0.5       4.0      2.0       10                  11   
                                           8.0      3.0       10                  16   
                                           16.0     3.0       10                  23   
                                 0.0       8.0      10.0      10                   9   
                                 0.1       16.0     1.0       0                   70   
                                 0.0       16.0     1.0       10                  12   
                                                              1                   11   
                                                              2                   11   
                                                              0                   10   
                                 0.1       4.0      2.0       2                    8   
                                           8.0      2.0       3                   10   
                                           16.0     2.0       10                  13   
                                 0.0       8.0      4.0       10                   9   
                                                              1                    9   
...                                                                              ...   
                                 0.1       8.0      3.0       0                   10   
                                 0.0       8.0      3.0       1                    9   
                                                              0                    8   
                                                              2                    8   
                                 0.1       8.0      2.0       1                   10   
                                                    1.0       2                    9   
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                  519   
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                   11   
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                  514   
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                   2   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  0.1       0                  295   
                                                    1.0       0                  301   
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                  317   
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                    9   
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                  288   
LgtRgr.SGD.tfw  1000.0   9000.0  0.1       8.0      3.0       2                    9   
                         8000.0  0.1       8.0      3.0       2                    9   
                         7000.0  0.1       8.0      3.0       2                    9   
                         6000.0  0.1       8.0      3.0       2                    9   
                         5000.0  0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                  150   
                         2000.0  0.0       2000.0  -1.0       0                   55   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                    5   
LgtRgr.SGD.tfw  100.0    1000.0  0.1       16.0     1.0       10                   2   
                1000.0   1000.0  0.1       8.0      3.0       2                    9   
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   1.0       0                    5   
                                                    10.0      0                    7   
LgtRgr.skl     -1.0      1000.0  0.0       1000.0  -1.0       0                   28   
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                    9   
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                    8   

                                                                                                                        model  
id             nStepsTfw nObsFit rotatePby nObsBtc lrnRateTfw rotateMaxAgl                                                     
LgtRgr.SGD.tfw  2804.0   22424.0 0.1       8.0      3.0       2             <tensorflow.python.client.session.Session obje...  
LgtRgr.tfw      1000.0   22424.0 0.0       22424.0  10.0      0                                                           NaN  
LgtRgr.skl     -1.0      22424.0 0.0       22424.0 -1.0       0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   18077.0 0.5       4.0      3.0       10                                                          NaN  
                100.0    18077.0 0.1       16.0     1.0       10                                                          NaN  
                1000.0   18077.0 0.0       16.0     2.0       10                                                          NaN  
                                                              1                                                           NaN  
                                                              0                                                           NaN  
                                                              2                                                           NaN  
                                 0.1       16.0     3.0       10                                                          NaN  
                                           4.0      3.0       1                                                           NaN  
                                           8.0      2.0       0                                                           NaN  
                                 0.0       8.0      2.0       10                                                          NaN  
                                                              1                                                           NaN  
                                                              0                                                           NaN  
                                                              2                                                           NaN  
                                 0.5       4.0      2.0       10                                                          NaN  
                                           8.0      3.0       10                                                          NaN  
                                           16.0     3.0       10                                                          NaN  
                                 0.0       8.0      10.0      10                                                          NaN  
                                 0.1       16.0     1.0       0                                                           NaN  
                                 0.0       16.0     1.0       10                                                          NaN  
                                                              1                                                           NaN  
                                                              2                                                           NaN  
                                                              0                                                           NaN  
                                 0.1       4.0      2.0       2                                                           NaN  
                                           8.0      2.0       3                                                           NaN  
                                           16.0     2.0       10                                                          NaN  
                                 0.0       8.0      4.0       10                                                          NaN  
                                                              1                                                           NaN  
...                                                                                                                       ...  
                                 0.1       8.0      3.0       0                                                           NaN  
                                 0.0       8.0      3.0       1                                                           NaN  
                                                              0                                                           NaN  
                                                              2                                                           NaN  
                                 0.1       8.0      2.0       1                                                           NaN  
                                                    1.0       2                                                           NaN  
LgtRgr.tfw      1000.0   18077.0 0.0       18077.0  10.0      0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   18077.0 0.1       8.0      3.0       2                                                           NaN  
LgtRgr.skl     -1.0      15000.0 0.0       15000.0 -1.0       0                                                           NaN  
LgtRgr.SGD.tfw  100.0    10000.0 0.1       16.0     1.0       10                                                          NaN  
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  0.1       0                                                           NaN  
                                                    1.0       0                                                           NaN  
LgtRgr.skl     -1.0      10000.0 0.0       10000.0 -1.0       0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   10000.0 0.1       8.0      3.0       2                                                           NaN  
LgtRgr.tfw      1000.0   10000.0 0.0       10000.0  10.0      0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   9000.0  0.1       8.0      3.0       2                                                           NaN  
                         8000.0  0.1       8.0      3.0       2                                                           NaN  
                         7000.0  0.1       8.0      3.0       2                                                           NaN  
                         6000.0  0.1       8.0      3.0       2                                                           NaN  
                         5000.0  0.1       8.0      3.0       2                                                           NaN  
LgtRgr.skl     -1.0      5000.0  0.0       5000.0  -1.0       0                                                           NaN  
                         2000.0  0.0       2000.0  -1.0       0                                                           NaN  
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   0.1       0                                                           NaN  
LgtRgr.SGD.tfw  100.0    1000.0  0.1       16.0     1.0       10                                                          NaN  
                1000.0   1000.0  0.1       8.0      3.0       2                                                           NaN  
LgtRgr.tfw      100.0    1000.0  0.0       1000.0   1.0       0                                                           NaN  
                                                    10.0      0                                                           NaN  
LgtRgr.skl     -1.0      1000.0  0.0       1000.0  -1.0       0                                                           NaN  
LgtRgr.SGD.tfw  1000.0   100.0   0.1       8.0      3.0       2                                                           NaN  
LgtRgr.skl     -1.0      100.0   0.0       100.0   -1.0       0                                                           NaN  

[121 rows x 8 columns]
In [27]:
myexportDf(glbMdlDf, 
           save_filepathname = glbPickleFile['models'],
           save_drop_cols = 'model'
          )
Compressed pickle file: data/img_M_SFDD_ImgSz_64.pickle; size: 41 KB

Output submission

In [28]:
print '\n finMdl:'
glbwriteSubmission(glbINew, finYNewPby, 
    'img_04_fit_lgtRgr_SGD_Tfw_SFDD_ImgSz_' + str(glbImg['size']) + \
                   '_sbmt_fin.csv')
 finMdl:
                           img   c0   c1   c2   c3            c4   c5  \
img                                                                     
img_1.jpg            img_1.jpg  0.0  0.0  0.0  0.0  7.011857e-02  0.0   
img_10.jpg          img_10.jpg  0.0  0.0  0.0  1.0  0.000000e+00  0.0   
img_100.jpg        img_100.jpg  1.0  0.0  0.0  0.0  1.445693e-27  0.0   
img_1000.jpg      img_1000.jpg  0.0  0.0  0.0  0.0  1.000000e+00  0.0   
img_100000.jpg  img_100000.jpg  0.0  0.0  0.0  0.0  1.000000e+00  0.0   

                          c6        c7   c8   c9  
img                                               
img_1.jpg       0.000000e+00  0.929881  0.0  0.0  
img_10.jpg      0.000000e+00  0.000000  0.0  0.0  
img_100.jpg     0.000000e+00  0.000000  0.0  0.0  
img_1000.jpg    6.692277e-32  0.000000  0.0  0.0  
img_100000.jpg  0.000000e+00  0.000000  0.0  0.0  
                         img   c0   c1   c2   c3   c4   c5   c6   c7   c8   c9
img                                                                           
img_99994.jpg  img_99994.jpg  0.0  0.0  0.0  0.0  1.0  0.0  0.0  0.0  0.0  0.0
img_99995.jpg  img_99995.jpg  0.0  0.0  0.0  0.0  1.0  0.0  0.0  0.0  0.0  0.0
img_99996.jpg  img_99996.jpg  0.0  0.0  0.0  0.0  1.0  0.0  0.0  0.0  0.0  0.0
img_99998.jpg  img_99998.jpg  0.0  0.0  0.0  0.0  0.0  0.0  1.0  0.0  0.0  0.0
img_99999.jpg  img_99999.jpg  0.0  0.0  0.0  0.0  0.0  0.0  1.0  0.0  0.0  0.0

exporting 79726 rows to img_04_fit_lgtRgr_SGD_Tfw_SFDD_ImgSz_64_sbmt_fin.csv...
In [29]:
prtStr = 'LeaderBoard metric for this sel submission: %0.5f vs. ' + \
        'logLossVld (sel): %0.5f'
print prtStr % (22.62562, 20.5467)
prtStr = 'LeaderBoard metric for this fin submission: %0.5f vs. ' + \
        'logLossVld (fin): %0.5f'
print prtStr % (23.71528,  4.8369)
print 'Best score yet:%s: %0.5f' % \
    ('img_02_fit_lgtRgr(Skl)_SFDD_(ImgSz_32_)sbmt(_fin).csv', 2.63892)
LeaderBoard metric for this sel submission: 22.62562 vs. logLossVld (sel): 20.54670
LeaderBoard metric for this fin submission: 23.71528 vs. logLossVld (fin): 4.83690
Best score yet:img_02_fit_lgtRgr(Skl)_SFDD_(ImgSz_32_)sbmt(_fin).csv: 2.63892

Stop here

Following code should be in img04_fit_lgtRgrSGDTf

Let's now switch to stochastic gradient descent training instead, which is much faster.

The graph will be similar, except that instead of holding all the training data into a constant node, we create a Placeholder node which will be fed actual data at every call of sesion.run().

In [6]:
import pandas as pd
models = pd.DataFrame({'nRELUs': [0]})
#models.ix[0, 'accuracy_scoreTest'] = 0
print models
   nRELUs
0       0
In [7]:
batch_size = 128

graph = tf.Graph()
with graph.as_default():

  # Input data. For the training data, we use a placeholder that will be fed
  # at run time with a training minibatch.
  tfwObsFitFtr = tf.placeholder(tf.float32,
                                    shape=(batch_size, glbImg['size'] * glbImg['size']))
  tfwObsFitRsp = tf.placeholder(tf.float32, shape=(batch_size, glbRspClassN))
  tfwObsVldFtr = tf.constant(glbXVld)
  tfwObsNewFtr = tf.constant(glbXNew)
  
  # Variables.
  tfwW = tf.Variable(
    tf.truncated_normal([glbImg['size'] * glbImg['size'], glbRspClassN]))
  tfwB = tf.Variable(tf.zeros([glbRspClassN]))
  print(tfwW.initialized_value())
  print(tfwB.initialized_value())    
  
  # Training computation.
  logits = tf.matmul(tfwObsFitFtr, tfwW) + tfwB
  loss = tf.reduce_mean(
    tf.nn.softmax_cross_entropy_with_logits(logits, tfwObsFitRsp))
  
  # Optimizer.
  optimizer = tf.train.GradientDescentOptimizer(0.5).minimize(loss)
  
  # Predictions for the training, validation, and test data.
  tfwObsTrnPred = tf.nn.softmax(logits)
  tfwObsVldPred = tf.nn.softmax(
    tf.matmul(tfwObsVldFtr, tfwW) + tfwB)
  tfwObsNewPred = tf.nn.softmax(tf.matmul(tfwObsNewFtr, tfwW) + tfwB)
Tensor("Identity:0", shape=TensorShape([Dimension(784), Dimension(10)]), dtype=float32)
Tensor("Identity_1:0", shape=TensorShape([Dimension(10)]), dtype=float32)

Let's run it:

In [8]:
nStepsTfw = 3001

with tf.Session(graph=graph) as session:
  tf.initialize_all_variables().run()
  print("Initialized")
  for step in range(nStepsTfw):
    # Pick an offset within the training data, which has been randomized.
    # Note: we could use better randomization across epochs.
    offset = (step * batch_size) % (glbYFit.shape[0] - batch_size)
    # Generate a minibatch.
    batch_data = glbXFit[offset:(offset + batch_size), :]
    batch_labels = glbYFit[offset:(offset + batch_size), :]
    # Prepare a dictionary telling the session where to feed the minibatch.
    # The key of the dictionary is the placeholder node of the graph to be fed,
    # and the value is the numpy array to feed to it.
    feed_dict = {tfwObsFitFtr : batch_data, tfwObsFitRsp : batch_labels}
    _, l, predictions = session.run(
      [optimizer, loss, tfwObsTrnPred], feed_dict=feed_dict)
    if (step % 500 == 0):
      print("Minibatch loss at step %d: %f" % (step, l))
      print("Minibatch accuracy_score: %.1f%%" % accuracy_score(predictions, batch_labels))
      print("Validation accuracy_score: %.1f%%" % accuracy_score(
        tfwObsVldPred.eval(), glbYVld))
  print("Test accuracy_score: %.1f%%" % accuracy_score(tfwObsNewPred.eval(), glbYNew))
  models.ix[0, 'accuracy_scoreVld'] = accuracy_score(tfwObsVldPred.eval(), glbYVld)
  models.ix[0, 'accuracy_scoreTst'] = accuracy_score( tfwObsNewPred.eval(),  glbYNew)
Initialized
Minibatch loss at step 0: 17.272371
Minibatch accuracy: 6.2%
Validation accuracy: 13.0%
Minibatch loss at step 500: 1.435902
Minibatch accuracy: 76.6%
Validation accuracy: 75.2%
Minibatch loss at step 1000: 1.280029
Minibatch accuracy: 78.1%
Validation accuracy: 77.2%
Minibatch loss at step 1500: 1.147653
Minibatch accuracy: 77.3%
Validation accuracy: 77.2%
Minibatch loss at step 2000: 1.262677
Minibatch accuracy: 72.7%
Validation accuracy: 77.9%
Minibatch loss at step 2500: 0.777248
Minibatch accuracy: 83.6%
Validation accuracy: 77.3%
Minibatch loss at step 3000: 1.085464
Minibatch accuracy: 77.3%
Validation accuracy: 78.6%
Test accuracy: 86.1%
In [9]:
models.ix[0, 'graph'] = graph
print(models)
   nRELUs  accuracyVld  accuracyTst  \
0       0        78.57    86.098056   

                                               graph  
0  <tensorflow.python.framework.ops.Graph object ...  

Problem

Turn the logistic regression example with SGD into a 1-hidden layer neural network with rectified linear units (nn.relu()) and 1024 hidden nodes. This model should improve your validation / test accuracy_score.


In [10]:
nRELUs = [2 ** thsRelu for thsRelu in xrange(11)]
print(nRELUs)
for thsRelu in nRELUs:
    models.ix[thsRelu, 'nRELUs'] = thsRelu

print models
[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024]
      nRELUs  accuracyVld  accuracyTst  \
0          0        78.57    86.098056   
1          1          NaN          NaN   
2          2          NaN          NaN   
4          4          NaN          NaN   
8          8          NaN          NaN   
16        16          NaN          NaN   
32        32          NaN          NaN   
64        64          NaN          NaN   
128      128          NaN          NaN   
256      256          NaN          NaN   
512      512          NaN          NaN   
1024    1024          NaN          NaN   

                                                  graph  
0     <tensorflow.python.framework.ops.Graph object ...  
1                                                   NaN  
2                                                   NaN  
4                                                   NaN  
8                                                   NaN  
16                                                  NaN  
32                                                  NaN  
64                                                  NaN  
128                                                 NaN  
256                                                 NaN  
512                                                 NaN  
1024                                                NaN  
In [49]:
thsRelu = nRELUs[9]
batch_size = 128

graph = tf.Graph()
with graph.as_default():

  # Input data. For the training data, we use a placeholder that will be fed
  # at run time with a training minibatch.
  tfwObsFitFtr = tf.placeholder(tf.float32,
                                    shape=(batch_size, glbImg['size'] * glbImg['size']))
  tfwObsFitRsp = tf.placeholder(tf.float32, shape=(batch_size, glbRspClassN))
  tfwObsVldFtr = tf.constant(glbXVld)
  tfwObsNewFtr = tf.constant(glbXNew)
  
  # Variables.
  tfwW1 = tf.Variable(
    tf.truncated_normal([glbImg['size'] * glbImg['size'], thsRelu]), name = 'tfwW1')
  tfwB1 = tf.Variable(tf.zeros([thsRelu]), name = 'tfwB1')
  tfwW2 = tf.Variable(
    tf.truncated_normal([thsRelu, glbRspClassN]), name = 'tfwW2')
  tfwB2 = tf.Variable(tf.zeros([glbRspClassN]), name = 'tfwB2')
  print(tfwW1.initialized_value())
  print(tfwB1.initialized_value())
  #print(relus.initialized_value())
  print(tfwW2.initialized_value())
  print(tfwB2.initialized_value())
  #tf.Print(relus, [relus])  
     
  # Training computation.
  layer1 = tf.matmul(tfwObsFitFtr, tfwW1) + tfwB1
  layer2 = tf.nn.relu(layer1)
  layer3 = tf.matmul(layer2, tfwW2) + tfwB2
  loss = tf.reduce_mean(
    tf.nn.softmax_cross_entropy_with_logits(layer3, tfwObsFitRsp))
  
  # Optimizer.
  optimizer = tf.train.GradientDescentOptimizer(0.5).minimize(loss)
  
  # Predictions for the training, validation, and test data.
  tfwObsTrnPred = tf.nn.softmax(layer3)
  tfwObsVldPred = tf.nn.softmax(
    tf.matmul(tf.nn.relu(tf.matmul(tfwObsVldFtr, tfwW1) + tfwB1), tfwW2) + tfwB2)
  tfwObsNewPred = tf.nn.softmax(
    tf.matmul(tf.nn.relu(tf.matmul(tfwObsNewFtr, tfwW1) + tfwB1), tfwW2) + tfwB2)
Tensor("Identity:0", shape=TensorShape([Dimension(784), Dimension(512)]), dtype=float32)
Tensor("Identity_1:0", shape=TensorShape([Dimension(512)]), dtype=float32)
Tensor("Identity_2:0", shape=TensorShape([Dimension(512), Dimension(10)]), dtype=float32)
Tensor("Identity_3:0", shape=TensorShape([Dimension(10)]), dtype=float32)
In [50]:
nStepsTfw = 3001

with tf.Session(graph=graph) as session:
  tf.initialize_all_variables().run()
  print("Initialized")
  for step in range(nStepsTfw):
    # Pick an offset within the training data, which has been randomized.
    # Note: we could use better randomization across epochs.
    offset = (step * batch_size) % (glbYFit.shape[0] - batch_size)
    # Generate a minibatch.
    batch_data = glbXFit[offset:(offset + batch_size), :]
    batch_labels = glbYFit[offset:(offset + batch_size), :]
    # Prepare a dictionary telling the session where to feed the minibatch.
    # The key of the dictionary is the placeholder node of the graph to be fed,
    # and the value is the numpy array to feed to it.
    feed_dict = {tfwObsFitFtr : batch_data, tfwObsFitRsp : batch_labels}
    _, l, predictions = session.run(
      [optimizer, loss, tfwObsTrnPred], feed_dict=feed_dict)
    if (step % 500 == 0):
      print("Minibatch loss at step %d: %f" % (step, l))
      print("Minibatch accuracy_score: %.1f%%" % accuracy_score(predictions, batch_labels))
      print("Validation accuracy_score: %.1f%%" % accuracy_score(
        tfwObsVldPred.eval(), glbYVld))
  print("Test accuracy_score: %.1f%%" % accuracy_score(tfwObsNewPred.eval(), glbYNew))
  models.ix[thsRelu, 'accuracy_scoreVld'] = accuracy_score(tfwObsVldPred.eval(), glbYVld)
  models.ix[thsRelu, 'accuracy_scoreTst'] = accuracy_score( tfwObsNewPred.eval(),  glbYNew)
  models.ix[thsRelu, 'graph'] = graph
  print(models)
Initialized
Minibatch loss at step 0: 235.251495
Minibatch accuracy: 14.1%
Validation accuracy: 23.9%
Minibatch loss at step 500: 15.635325
Minibatch accuracy: 72.7%
Validation accuracy: 77.7%
Minibatch loss at step 1000: 5.719280
Minibatch accuracy: 83.6%
Validation accuracy: 78.3%
Minibatch loss at step 1500: 3.931793
Minibatch accuracy: 76.6%
Validation accuracy: 75.8%
Minibatch loss at step 2000: 3.211185
Minibatch accuracy: 75.0%
Validation accuracy: 78.1%
Minibatch loss at step 2500: 1.988469
Minibatch accuracy: 80.5%
Validation accuracy: 78.0%
Minibatch loss at step 3000: 3.435107
Minibatch accuracy: 77.3%
Validation accuracy: 79.1%
Test accuracy: 86.7%
      nRELUs  accuracyVld  accuracyTst  \
0          0        78.57    86.098056   
1          1        19.29    19.750053   
2          2        36.26    40.087588   
4          4        64.67    71.122623   
8          8        75.80    82.861568   
16        16        79.74    86.685537   
32        32        76.77    84.287545   
64        64        78.79    86.172826   
128      128        78.86    86.210211   
256      256        79.21    86.407819   
512      512        79.12    86.674856   
1024    1024        81.26    88.335826   

                                                  graph  
0     <tensorflow.python.framework.ops.Graph object ...  
1     <tensorflow.python.framework.ops.Graph object ...  
2     <tensorflow.python.framework.ops.Graph object ...  
4     <tensorflow.python.framework.ops.Graph object ...  
8     <tensorflow.python.framework.ops.Graph object ...  
16    <tensorflow.python.framework.ops.Graph object ...  
32    <tensorflow.python.framework.ops.Graph object ...  
64    <tensorflow.python.framework.ops.Graph object ...  
128   <tensorflow.python.framework.ops.Graph object ...  
256   <tensorflow.python.framework.ops.Graph object ...  
512   <tensorflow.python.framework.ops.Graph object ...  
1024  <tensorflow.python.framework.ops.Graph object ...  
In [52]:
plt.figure()
#plt.plot(models['nRELUs'], models['accuracy_score.fit'], 'bo-', label = 'fit')
plt.plot(models['nRELUs'], models['accuracy_scoreVld'], 'rs-', label = 'vld')
plt.plot(models['nRELUs'], models['accuracy_scoreTst'], 'gp-', label = 'new')
plt.legend(loc = 'lower right')
plt.title("accuracy_score")
plt.xscale('symlog', basex=2)
axes = plt.gca()
axes.set_xlabel('nRELUs')
# axes.set_xlim([mdlDF['l1_penalty'][mdlDF['RSS.vld'].argmin()] / 10 ** 2, \
#                mdlDF['l1_penalty'][mdlDF['RSS.vld'].argmin()] * 10 ** 2])
# axes.set_ylim([0, mdlDF['RSS.vld'].min() * 1.5])
plt.show()
In [ ]: